conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.31k stars 986 forks source link

[question] Is there a flag to silence `cmake` messages related to `conan`? #17191

Closed i-ilak closed 1 month ago

i-ilak commented 1 month ago

What is your question?

When running something like

conan install /path/to/conanfile
cmake --preset conan-release

As user you will be confronted with some messages that were generate from creating the cmake targets that are Conan related. They come from lines like this one here and similar places.

Depending on what packages (e.g. something like Qt) or how many packages one uses in a project, this can generate hundreds/thousands of lines of output. As far as I can tell from the code, it is currently not possible to silence this...

Are there any plans on changing this? E.g. something like a CONAN_SILENCE_CMAKE_OUTPUT flag that would let the user turn this of if he choses to do so?

Have you read the CONTRIBUTING guide?

memsharded commented 1 month ago

Hi @i-ilak

Thanks for your question.

If you check the line that you are sharing, you can see a {{ file_name }}_MESSAGE_MODE that determines the verbosity.

This variable is define from

if({{ file_name }}_FIND_QUIETLY)
     set({{ file_name }}_MESSAGE_MODE VERBOSE)
else()
     set({{ file_name }}_MESSAGE_MODE STATUS)
endif()

Which in turns is defined by the find_package( QUIET)

i-ilak commented 1 month ago

Thanks a lot for the answer, was not familiar with this cmake functionality... Sorry for the disturbance!

memsharded commented 1 month ago

Happy to help, thanks for the feedback!