CMake debug find
CMake --debug-find
option gives extensive human-readable trace output for where the CMake find_
operations are looking for files.
In most CMake projects, there are many find_
operations, and so the cmake --debug-find
output can be overwhelming to scroll through.
The example commands refer to this CMake script:
# arbitrary other packages not of interest to trace finding
find_package(Git)
# package that's not working right, to debug
find_package(LAPACK)
# arbitrary find_* to trace variable
find_library(MYLIB NAMES mylib)
Package-specific debug-find is available:
cmake --debug-find-pkg=LAPACK
Variable-specific debug-find is available:
cmake --debug-find-var=MYLIB
It’s also possible to target specific find_* calls via CMAKE_FIND_DEBUG_MODE. To debug only the finding of LAPACK:
# arbitrary other packages that are not of interest to trace finding
find_package(Git)
# package that's not working right, to debug
set(CMAKE_FIND_DEBUG_MODE on)
find_package(LAPACK)
set(CMAKE_FIND_DEBUG_MODE off)