简体   繁体   English

CMake-target_link_libraries和真实库名

[英]CMake - target_link_libraries and a real library name

I have an example library and two symbolic links: 我有一个示例库和两个符号链接:

libname.so -> libname.so.3
libname.so.3 -> libname.so.3.0

When I use this command: 当我使用此命令时:

target_link_libraries(app /home/theuser/libs/mylib/libname.so)

program works, but when I use following command: target_link_libraries(app /home/theuser/libs/mylib/libname.so.3.0) 程序有效,但是当我使用以下命令时: target_link_libraries(app /home/theuser/libs/mylib/libname.so.3.0)

I get an info: error while loading shared libraries: libname.so.3: cannot open shared object file: No such file or directory during program execution (after cmake and make steps). 我收到一个信息: error while loading shared libraries: libname.so.3: cannot open shared object file: No such file or directory程序执行期间(在cmake和make步骤之后) error while loading shared libraries: libname.so.3: cannot open shared object file: No such file or directory Why cmake can't get a lib directly (without symbolic links) ? 为什么cmake无法直接获取lib(没有符号链接)? Is it posiible ? 可行吗?

We use this syntax daily without symlinks and it definitely works. 我们每天都在不使用符号链接的情况下使用此语法,它肯定有效。 Is it possible that it needs a "normal lib-like" file name into target_link_library? 是否可能需要在target_link_library中添加“类似于lib的正常”文件名? I would try to include .so files only in my link chain to see if it works first. 我会尝试仅在我的链接链中包括.so文件,以查看它是否首先起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 cmake如何判断target_link_libraries项是库名还是目标? - How cmake judging target_link_libraries item is a library name or a target? 库上的CMake和target_link_libraries取决于另一个库 - CMake and target_link_libraries on library depending on another lib CMake TARGET_LINK_LIBRARIES中包含多个静态库 - Multiple static library inclusion in CMake TARGET_LINK_LIBRARIES Cmake target_link_libraries 没有链接我的库 - Cmake target_link_libraries not linking my library cmake:target_link_libraries使用不共享的静态库 - cmake: target_link_libraries use static library not shared CMake target_link_libraries不保留顺序 - CMake target_link_libraries not preserving order 何时在target_link_libraries中包含库 - When to include a library in target_link_libraries 未定义对 function 的引用,但我的 function 是我在 cmake 中使用命令 target_link_libraries 链接的库的一部分 - undefined reference to function but my function is a part of a library that I link in cmake with the command target_link_libraries 如何在自定义目录中安装cmake软件包并按名称将其链接到target_link_libraries()? - How to install a cmake package in a custom directory and link it with target_link_libraries() by name? 在CMake中,指定所有可执行文件target_link_libraries某些库 - In CMake, specify all executables target_link_libraries certain libraries
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM