Giter VIP home page Giter VIP logo

cmake_cxx_go's People

Contributors

gangliao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmake_cxx_go's Issues

build c executable with go static library, can not find header and `.a`

I have a library client in folder ./client, and have an executable I want to build in folder ./client/test. But when doing make, it reports can not find header file (the header file is generated when doing go build).

./CMakeLists.txt:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

cmake_minimum_required(VERSION 3.0)

project(cxx_go C Go)

include(cmake/golang.cmake)
include(cmake/flags.cmake)


add_subdirectory(client)
add_subdirectory(client/test)

./client/CMakeLists.txt:

ExternalGoProject_Add(pserver github.com/PaddlePaddle/Paddle/paddle/go/pserver)
add_go_library(client STATIC pserver)

./client/test/CMakeList.txt:

#include_directories(/home/helin/env/gopath/src/github.com/PaddlePaddle/Paddle/paddle/go/pserver/lib/build/client)
add_executable(main main.c)
add_dependencies(main client)
set (CMAKE_EXE_LINKER_FLAGS "-pthread")
#target_link_libraries(main /home/helin/env/gopath/src/github.com/PaddlePaddle/Paddle/paddle/go/pserver/lib/build/client/libclient.a)
target_link_libraries(main)

If I un-comment the two lines in above file, it could work. But how can I not hard code absolute path into the cmake file?

Cannot find C header file error during building

$ rm -rf * ; cmake .. && make -j12
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The Golang compiler identification is go1.8.1 darwin/amd64
-- Check for working Golang compiler: /usr/local/bin/go
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/cmake_cxx_go/build
Scanning dependencies of target main
Scanning dependencies of target adder
Scanning dependencies of target go_redis
make[2]: *** No rule to make target `src/static_and_shared/libadder.a', needed by `src/static_and_shared/main'.  Stop.
make[2]: *** Waiting for unfinished jobs....
[ 50%] Building CXX object src/static_and_shared/CMakeFiles/main.dir/main.cxx.o
[ 50%] Generating /.timestamp
/tmp/cmake_cxx_go/src/static_and_shared/main.cxx:1:10: fatal error: 'libadder.h' file not found
#include "libadder.h"
         ^
1 error generated.
make[2]: *** [src/static_and_shared/CMakeFiles/main.dir/main.cxx.o] Error 1
make[1]: *** [src/static_and_shared/CMakeFiles/main.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 50%] Built target go_redis
[ 50%] Built target adder
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.