gnu-make verbose - Using CMake with GNU Make:How can I see the exact commands?

configure find_package (5)

It is convenient to set the option in the CMakeLists.txt file as:


I use CMake with GNU Make and would like to see all commands exactly (for example how the compiler is executed, all the flags etc.).

GNU make has --debug, but it does not seem to be that helpful are there any other options? Does CMake provide additional flags in the generated Makefile for debugging purpose?

I was trying something similar to ensure the -ggdb flag was present.

Call make in a clean directory and grep the flag you are looking for. Looking for debug rather than ggdb I would just write.

make VERBOSE=1 | grep debug

The -ggdb flag was obscure enough that only the compile commands popped up.

If you use the CMake GUI then swap to the advanced view and then the option is called CMAKE_VERBOSE_MAKEFILE.

Or simply export VERBOSE environment variable on the shell like this: export VERBOSE=1

I'm using GNU Make from the GnuWin32 project, see but there haven't been any updates for a while now, so I'm not sure on this project's status.

cmake gnu-make