CMake find_package: where did it find the package?
Asked Answered
A

2

17

In my CMake package, there is a call to find_package. This succeeds, great! However, it turns out to be the wrong version of the package. I now want to go and delete that package. However, I have no idea where the heck it is on my system, nor where the -config.cmake file is that CMake must have found somewhere. Is there a way to get find_package to give me this information? Or at least verbosely tell me where it is searching?

I though this might be in the variable CMAKE_MODULE_PATH, however that is empty for me. So I guess it is in the default paths somewhere. But CMake searches a lot of places for packages, and I didn't find it in the usual locations that I remember.

Alleviation answered 21/11, 2018 at 10:42 Comment(0)
A
10

Ah ok, I found a solution here:

https://riptutorial.com/cmake/example/21128/debug-find-package---errors

Turns out there is a special debug flag to make find_package tell you where it is searching:

cmake -D CMAKE_FIND_DEBUG_MODE=ON ..
Alleviation answered 21/11, 2018 at 10:49 Comment(0)
N
14

As of CMake 3.17, the cmake command line has native support for printing the search directories for all of the CMake find_* commands. Use the --debug-find flag:

cmake --debug-find ..
Noblesse answered 13/2, 2020 at 13:20 Comment(0)
A
10

Ah ok, I found a solution here:

https://riptutorial.com/cmake/example/21128/debug-find-package---errors

Turns out there is a special debug flag to make find_package tell you where it is searching:

cmake -D CMAKE_FIND_DEBUG_MODE=ON ..
Alleviation answered 21/11, 2018 at 10:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.