CMakeDeps: heed <PackageName>_FIND_QUIETLY - #12967
Conversation
praetorian20
left a comment
There was a problem hiding this comment.
@memsharded this PR is related to our discussion here. Please let me know if I'm on the right track with this change.
| endif() | ||
|
|
||
| if({{ file_name }}_FIND_QUIETLY) | ||
| set({{ file_name }}_MESSAGE_MODE VERBOSE) |
There was a problem hiding this comment.
Should I unset {{ file_name }}_MESSAGE_MODE at the end of either/both files?
There was a problem hiding this comment.
I think it might not be necessary, as the scope is well defined, shouldn't be an issue.
| get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
| file(GLOB DATA_FILES "{{data_pattern}}") | ||
|
|
||
| if(NOT DEFINED {{ file_name }}_MESSAGE_MODE) |
There was a problem hiding this comment.
Is it OK to assume the code generated by config..py is included before this? Or should I replicate the if({{ file_name }}_FIND_QUIETLY) check here?
There was a problem hiding this comment.
Yes, it is safe, this file will always be included from xxx-config.cmake, if that is what you mean, so {{ file_name }}_MESSAGE_MODE should already be defined at this point.
There was a problem hiding this comment.
I think this is looking good.
But the CI is broken, it seems some missing bracket or something for jinja rendering, please check https://ci.conan.io/blue/organizations/jenkins/ConanTestSuite/detail/PR-12967/1/pipeline
Also, it would be necessary to add a unittest or at least a check in one existing test.
| endif() | ||
|
|
||
| if({{ file_name }}_FIND_QUIETLY) | ||
| set({{ file_name }}_MESSAGE_MODE VERBOSE) |
There was a problem hiding this comment.
I think it might not be necessary, as the scope is well defined, shouldn't be an issue.
| get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
| file(GLOB DATA_FILES "{{data_pattern}}") | ||
|
|
||
| if(NOT DEFINED {{ file_name }}_MESSAGE_MODE) |
There was a problem hiding this comment.
Yes, it is safe, this file will always be included from xxx-config.cmake, if that is what you mean, so {{ file_name }}_MESSAGE_MODE should already be defined at this point.
Conan packages using the CMakeDeps generator will now stop printing status messages if the QUIET argument is passed to the respective find_package() CMake call. Fixes conan-io#9959 Fixes conan-io#10857
7e15bfd to
aaaf8cc
Compare
|
Sorry about the broken template code, I think it's fixed in the latest patchset. I'll look into adding unit tests but I haven't been able to run them successfully yet. I keep running into this error with a lot of the cmakedeps tests even though I have cmake 3.22 installed - I'm following the instructions for running tests using pytest and executing this command - |
No worries! Yes, we have some dicts defining tools and versions in |
|
I have added a unit-test |
|
Thank you for adding the unit test and for the pointer to |
Changelog: Feature: Conan packages using the CMakeDeps generator will now stop printing status messages if the QUIET argument is passed to the respective find_package() CMake call.
Docs: Omit
Fixes #9959
Fixes #10857