c++cmakeconanconan-2

Make conan install print underlying compiler commands like g++ when building from source


I'd like conan install . --build=missing to print the underlying compiler commands when building from source.

Increasing the verbosity level (e.g. -vvv) doesn't help. I suspect I need to pass CMAKE_VERBOSE_MAKEFILE to CMake, but I can't figure out how to do that properly.

I'm using Conan 2 with CMake and the Unix Makefiles generator on Linux, but I can switch to Ninja if that helps.


Solution

  • If you check available configs with:

    $ conan config list verbose
    tools.build:verbosity: Verbosity of build systems if set. Possible values are 'quiet' and 'verbose'
    tools.compilation:verbosity: Verbosity of compilation tools if set. Possible values are 'quiet' and 'verbose'
    

    That means that tools.build:verbosity is the verbosity of the build system itself, like the --log-level of CMake, and the tools.compilation:verbosity is the verbosity of the compiler command line. This second one is the one that would set the CMAKE_VERBOSE_MAKEFILE variable automatically in the conan_tooclhain.cmake file generated by the CMakeToolchain generator