[cmake-developers] How to handle package Config.cmake files with dependencies ?

Alexander Neundorf neundorf at kde.org
Tue Mar 13 12:53:17 EDT 2012


On Tuesday 13 March 2012, Brad King wrote:
> On Sat, Mar 10, 2012 at 7:35 AM, Alexander Neundorf <neundorf at kde.org> 
wrote:
> > There is now a branch find_package_set_FOUND_VariableInConfigFile on
> > stage.
> > 
> > It behaves almost as you suggested: the _FOUND variable is only removed
> > before the Config file is loaded, if the variable exists and is false.
> > 
> > So if some Config file would test for the previous value of _FOUND, it
> > will still get the same result.
> 
> I don't remember anything in the previous discussion that motivated this.
> Why not unset it unconditionally?  The package config file should not
> need to care or adjust its behavior based on whether a stray _FOUND was
> set.  If it wants to communicate between multiple loads during the same
> CMake run then it can store information in other variables that are not
> set by find_package.
> 
> Is this just for compatibility?  

Yes, it is in order to change the behaviour as little as possible.

> Are we aware of any real uses of this?

In Config files, I am not aware.
In Find-modules, there are cases where people do shortcuts if it was TRUE 
before already.

For cases, where the previous value is ignored in the Config file, nothing 
changes.
For cases, where the previous value is tested using if(Foo_FOUND), still 
nothing changes.
The only case AFAICS where something would change is if a Config file checks 
using if(DEFINED Foo_FOUND), and Foo_FOUND was defined but FALSE before.

Alex



More information about the cmake-developers mailing list