链接到外部库如何让CMake将可执行文件链接到不在同一个CMake项目中构建的外部共享库?只是在做target_link_libraries(GLBall ${CMAKE_BINARY_DIR}/res/mylib.so)给出误差make[2]: *** No rule to make target `res/mylib.so', needed by `GLBall'. Stop.
make[1]: *** [CMakeFiles/GLBall.dir/all] Error 2
make: *** [all] Error 2
(GLBall is the executable)在我将库复制到二进制dir之后bin/res.我试着用find_library(RESULT mylib.so PATHS ${CMAKE_BINARY_DIR}/res)却失败了RESULT-NOTFOUND.
3 回答
慕斯王
TA贡献1864条经验 获得超2个赞
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/res)
TARGET_LINK_LIBRARIES(GLBall mylib)
添加回答
举报
0/150
提交
取消