As per this link There are three options (+1 extra found in the answer of HolyBlackCat):
1
If you can / want to modify the CMakeLists.txt
, you can just add
set(CMAKE_VERBOSE_MAKEFILE ON)
This has to be done in every CMakeLists.txt file in your project though, so it might be a bit cumbersome, if you want to enable it for the entire project.
2
To write the verbose changes directly to the makefile, you can run the cmake command which generates the make file with an additional flag:
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ./path
And, you guessed it, to disable it, you need to run it again:
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF ./path
3
Finally, if you build your project by calling make
and do not use the cmake --build ./path
or cmake --build ./path --target target
commands, you can pass it as an option to make
directly:
make VERBOSE=1;
Although I would not recommend it, because they whole point of cmake is to not have to use make anymore (although it's still called behind the scenes).