调试CMake find_library [英] Debug CMake find_library
问题描述
是否可以从CMake调试 find_library
?
Is it possible to debug find_library
from CMake?
我想要的是考虑路径的列表.我的用例是像这样的呼叫
What I want is a list of considered paths. My use case is a call like
find_library (FOO_LIBRARY
NAMES foo foo.so.0)
在我的系统上有/lib64/libfoo.so.0
.但是,CMake找不到它.我检查了 FIND_LIBRARY_USE_LIB64_PATHS
是否设置为 TRUE
.
and there is /lib64/libfoo.so.0
on my system. However CMake does not find it. I checked that FIND_LIBRARY_USE_LIB64_PATHS
is set to TRUE
.
推荐答案
With CMake 3.17 this got added:
引入了"CMAKE_FIND_DEBUG_MODE"变量以打印更多内容查找cmake运行到标准错误期间的呼叫信息.输出是为人类消费而设计的,而不是为解析而设计的.
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命令.
So you pass either -DCMAKE_FIND_DEBUG_MODE=true
or --debug-find
to your CMake command.
以下是搜索libFOO时的示例输出:
Here is an example output when searching for 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 find_library的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!