Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell CMake to output the package search paths?

Tags:

windows

cmake

I'm compiling libdwarf on Windows. In its root CMakeLists.txt, it attempts to find LibElf via:

find_package(LibElf REQUIRED)

LibElf doesn't use CMAKE and I haven't configured it to register itself in any way, so of course the find_package fails. I'd like CMake to print out all the paths under which it is searching for LibElf at runtime. How do I tell CMake to output this? I've tried --trace but that just show me the execution flow through my CMakeLists.txt files--not the locations where CMake itself is presently looking for packages.

I know the documentation for find_package describes where CMake searches, but I can modify that behavior with all sorts of variables, environment variables, and registry settings. I'd like to see where exactly CMake is looking given all my modifications to those items I just mentioned.

I should note that libdwarf includes a cmake/FindLibElf.cmake module. Perhaps what I'm asking for isn't possible if FindLibElf.cmake is free to do whatever it pleases?

like image 571
watkipet Avatar asked Dec 18 '22 19:12

watkipet


1 Answers

Since version 3.17 CMake provides the option --debug-find, which results in output of a ton of debug information about search process of find_package and other find_* commands:

cmake --debug-find <...>

The similar effect could be achieved by setting the variable CMAKE_FIND_DEBUG_MODE.

One may set the variable either in the command line:

cmake -DCMAKE_FIND_DEBUG_MODE=1 <...>

or in the CMakeLists.txt:

set(CMAKE_FIND_DEBUG_MODE 1)
like image 55
Tsyvarev Avatar answered Dec 27 '22 21:12

Tsyvarev