[cmake-developers] Patch: Don't emit warning when config file not found

Christoph Grüninger foss at grueninger.de
Wed Oct 5 17:35:01 EDT 2016


Hi Brad,
I am sorry, but I have to take up this subject again.

I want to include Vc (sometimes called Vc-Devel) as an optional
dependency. Vc provides a ConfigVc.cmake.

1. When I use "find_package(Vc)", many users get warnings that neither
FindVc.cmake nor VcConfig.cmake is found. The warning looks scary and
even distracts myself when I am scanning for relevant warning. It is an
optional dependency, so a single line "Could NOT find Vc (FindVc.cmake
or VcConfig.cmake not found)" would be enough.

2. When I use "find_package(Vc QUIET)", Vc does not show up in the
feature summary.

How can I achieve both without patching CMake?

Bye
Christoph

Am 10.08.2016 um 15:17 schrieb Brad King:
> On 08/09/2016 04:35 PM, Christoph Grüninger wrote:
>> I am annoyed by the lengthy and disturbing warning CMake emits when a
>> package is not found because neither a Find*.cmake file is found nor a
>> *config.cmake file. I always try to have zero warnings, but missing
>> dependencies is common. Emitting a warning is too much and too noisy in
>> my opinion.
>>
>> Please find attached patch, which reduces the warning to a single line
>> with the status that the package was not found.
> 
> We went through many iterations on the wording of that message in
> response to user feedback before settling on what is currently there.
> When someone wants a package to be found they need a good explanation
> when it is not and hints about how to resolve the problem.
> 
> If a dependency is optional and it is not a problem to be missing
> then the project can use the find_package QUIET option and then
> optionally add its own message() about the missing package.
> 
> -Brad
> 


More information about the cmake-developers mailing list