cmake_minimum_required( VERSION 2.8 )
project ( code_test )
set( CMAKE_CXX_COMPILER "g++" )
set( CMAKE_BUILD_TYPE "Debug" )
set( CMAKE_CXX_FLAGS "-std=c++11 -O0" )
include_directories(
/home/lihua/anaconda3/include/python3.7m
)
link_directories(
/home/lihua/anaconda3/lib
)
target_link_libraries(code_test
libpython3.7m.so
)
add_executable( run_test test.cpp )
target_link_libraries(run_test code_test)
编译的时候在target_link_libraries为什么会报下面这个错误:
Cannot specify link libraries for target "code_test" which is not built by
this project.