Issue
When we initially configure using CMake, we get some messages about some of our find_package()
instructions, e.g.:
-- Found CUDAToolkit: /usr/local/cuda/include (found suitable version "12.0.140", minimum required is "10.1")
or:
-- Found Python: /usr/bin/python3.11 (found version "3.11.2") found components: Interpreter
but for other packages we find_package()
- nothing is printed by default.
Other than printing such a message myself - is there a way I can tell CMake to print some message along those lines for every package it finds?
Note: In this related question, the command-line option -D CMAKE_FIND_DEBUG_MODE=ON
is mentioned; but that prints a ton of debug information which I don't want.
Solution
tl;dr: As of CMake 3.26 - not without a custom Find script.
The packages you gave as examples have custom Find scripts, e.g. FindCUDAToolkit.cmake
, as part of the CMake distribution, which implement this behavior. If you write such a script for your own package, it could do this; but - chicken and egg problem: You need your package before you can use a find script, or at least someone to independently download and use your Find script.
For now, and trusting @fabian's comment and the CMake documentation not saying anything about this, I have filed issue 24936 against CMake to add this functionality.
Answered By - einpoklum Answer Checked By - David Goodson (WPSolving Volunteer)