[cmake-developers] find_package module-only policy

Brad King brad.king at kitware.com
Mon Feb 20 13:57:04 EST 2012

On 2/20/2012 1:06 PM, Alexander Neundorf wrote:
> On Monday 20 February 2012, Brad King wrote:
> ...
>> (2) Add the explicit MODULE and CONFIG mode keywords.  Warn if they
>> are used and the current minimum CMake version is not>= 2.8.8 so that
>> people do not add them in places that will break old versions.
> Should it only warn if no mode keyword is used, or should it also warn if
> NO_MODULE is used ?

Hmm...I think only if no mode keyword is used and no Find module is
present.  The NO_MODULE option is very old so I wouldn't warn about
its use even thought after 2.8.8 it will be the same as CONFIG.

> The behaviour without keyword would stay unchanged, i.e. first Find-modules,
> the config files ?

Yes through step (2) except for the messages being different after step (1).

Step (3) adds a warning when there is no mode keyword and no Find
module (and all the other conditions I stated).

> MODULE mode would be only Find-modules, no config files ?

Yes.  It would allow the error message to be very clear when no Find
module exists.  It is really only needed for symmetry and would not
really be needed in practice except for debugging.

I think that the first 2 steps along with proper documentation and PR
may be enough.  It provides all the tools projects need to produce
unambiguous messages but does not force anything.  We could also take
the "CMAKE_FIND_PACKAGE_WARN_NO_MODULE" part of step 3 because it
gives projects a choice.

After that we get into less satisfactory changes but I'm not totally
opposed to them.


More information about the cmake-developers mailing list