cmake - 调试 CMake find_library

标签 cmake

是否可以调试find_library来自 CMake?

我想要的是经过考虑的路径列表。我的用例是一个像

find_library (FOO_LIBRARY
              NAMES foo foo.so.0)

还有/lib64/libfoo.so.0在我的系统上。但是 CMake 没有找到它。我查了一下 FIND_LIBRARY_USE_LIB64_PATHS设置为 TRUE .

最佳答案

使用 CMake 3.17 这个 got added :

The “CMAKE_FIND_DEBUG_MODE” variable was introduced to print extra find call information during the cmake run to standard error. Output is designed for human consumption and not for parsing.



所以你通过 -DCMAKE_FIND_DEBUG_MODE=true--debug-find到您的 CMake 命令。

以下是搜索 libFOO 时的示例输出:
find_library considered the following locations:

/usr/local/lib64/(lib)FOO(\.so|\.a)
/usr/local/lib/(lib)FOO(\.so|\.a)
/usr/local/lib64/(lib)FOO(\.so|\.a)
/usr/local/lib/(lib)FOO(\.so|\.a)
/usr/local/lib64/(lib)FOO(\.so|\.a)
/usr/local/(lib)FOO(\.so|\.a)
/usr/lib64/(lib)FOO(\.so|\.a)
/usr/lib/(lib)FOO(\.so|\.a)
/usr/lib64/(lib)FOO(\.so|\.a)
/usr/lib/(lib)FOO(\.so|\.a)
/usr/lib64/(lib)FOO(\.so|\.a)
/usr/(lib)FOO(\.so|\.a)
/lib64/(lib)FOO(\.so|\.a)
/lib/(lib)FOO(\.so|\.a)
/opt/(lib)FOO(\.so|\.a)

The item was not found.

关于cmake - 调试 CMake find_library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49431342/

相关文章:

c++ - 使用 CMake 在构建后运行 C++ 程序

dependencies - CMake 和 CTest : How to make target "Nightly" actually build the tests

cmake - 如何找到.so文件的库名?

android - 如何强制 Cmake 执行多组件依赖的顶级 CMakeLists.txt?

cmake - 使用 CMake 检测 BLAS/LAPACK 供应商

linux - 使用软件 bam-window 软件的 cmake 错误

c++ - 使用Cmake编译LZO时提示找不到任何VS实例

c++ - 搬迁后打开Qt项目

cmake - 如何指定头文件引入的库依赖

c++ - 为什么 cmake_link_libraries 包含静态库?