相关疑难解决方法(0)

CMake链接到外部库

如何让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)
Run Code Online (Sandbox Code Playgroud)

在我将库复制到二进制目录后bin/res.

我试过用 find_library(RESULT mylib.so PATHS ${CMAKE_BINARY_DIR}/res)

哪个失败了RESULT-NOTFOUND.

cmake

109
推荐指数
5
解决办法
22万
查看次数

标签 统计

cmake ×1