可以通过加上add_link_options("LINKER:-rpath-link,${B_PATH}"),指定B的位置。也可以直接把库B放到库A的同级目录下。
$ mkdir -p build$ cd build$ cmake ..-- ...-- Found OpenMP_CXX: -fopenmp (found version "4.5")-- Found OpenMP: TRUE (found version "4.5")-- Result of try_compile: TRUE-- Performing Test omp_taskloop_test_2-- Performing Test omp_taskloop_test_2 - Success-- Result of check_c...
g++ -o opencv_test opencv_test.cpp `pkg-config --cflags --libs opencv` -Wall /usr/bin/ld: warning: libicui18n.so.54, needed by //home/yyh/anaconda2/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libicuuc.so.54, needed by //home/yyh...
g++ -o opencv_test opencv_test.cpp `pkg-config --cflags --libs opencv` -Wall /usr/bin/ld: warning: libicui18n.so.54, needed by //home/yyh/anaconda2/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libicuuc.so.54, needed by //home/yyh...
/usr/bin/ld: warning: libicuuc.so.54, needed by //home/yyh/anaconda2/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libicudata.so.54, needed by //home/yyh/anaconda2/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)...
/usr/bin/ld: warning: libirc.so, needed by /usr/lib/NAG26/cll6i261d/lib/libnagc_nag.so, not found (try using -rpath or -rpath-link) /usr/lib/NAG26/cll6i261d/lib/libnagc_nag.so: undefined reference to `__gtq' /usr/lib/NAG26/cll6i261d/lib/libnagc_nag.so: undefined referenc...
让CMake 检测主机处理器架构的替代方法是使用 C 或 C++中定义的符号,并使用 CMake 的try_run函数来构建并尝试执行源代码(参见第五章,配置时间和构建时间操作,第 8 个配方,探测执行),该操作由预处理器符号分支。这会返回可以在 CMake 侧捕获的定义良好的错误(此策略的灵感来自github.com/axr/solar-cmake/blo...
SKIP_BUILD_RPATH OFF BUILD_WITH_INSTALL_RPATH OFF INSTALL_RPATH "${message_RPATH}" INSTALL_RPATH_USE_LINK_PATH ON ) 让我们详细检查这个命令: SKIP_BUILD_RPATH OFF:告诉 CMake 生成适当的RPATH,以便能够在构建树内运行可执行文件。 BUILD_WITH_INSTALL_RPATH OFF:关闭生成具有与安装树相同的RPATH的可执行...
using boost::asio::use_awaitable; using boost::asio::ip::tcp; namespace this_coro = boost::asio::this_coro; awaitable<void> echo(tcp::socket socket) { try { std::array<char, max_length> data; while (true) { auto [ec, length] = co_await socket.async_read_some( boost::asio:...
还有一些属性用来指定RPATH规则。INSTALL_RPATH是一个分号分隔的list,它指定了在安装目标时使用的rpath(针对支持rpath的平台而言)(-rpath在gcc中用于在编译时指定加载动态库的路径;优先级较系统库路径要高。详情参见http://www.cmake.org/Wiki/CMake_RPATH_handling#What_is_RPATH_.3F——译注)。INSTALL_RPATH_USE...