[cmake-developers] Package Config files with COMPONENTS
Brad King
brad.king at kitware.com
Tue Mar 13 11:11:27 EDT 2012
On 3/10/2012 1:15 PM, Alexander Neundorf wrote:
> I pushed a branch ImprovedCOMPONENTSSupportInFindPackage to stage.
>
> It is not finished (documentation and an updated fphsa() are missing at
> least), but you may want to have a look at it.
>
> It adds
> * OPTIONAL_COMPONENTS
Will this interact well when a Find module forwards with NO_MODULE?
> * CMP0018: if a listed component is not found, Foo_FOUND is set to false in
> Config mode
I do not think CMP0018 can work quite as we need. If a project sets
the behavior to NEW how does it know the package configuration file
it finds will be aware that it needs to set the Foo_<component>_FOUND
variables? That is not something that cmake_minimum_required(VERSION)
can know when it sets the policy to NEW.
We don't know how packages out there interpret components. For some
it may just be a list which can always be satisfied. Others may
already provide a value equivalent to Foo_<component>_FOUND but with
a different name that makes more sense for their use case.
The relationship of <pkg>_FOUND and <pkg>'s components is specific to
each package. I think it should simply be up to the package config
file for the package to set <pkg>_FOUND based on its ability to
satisfy the requested components in whatever sense is meaningful
for the given package. This will be possible after the topic
find_package_set_FOUND_VariableInConfigFile is done.
I think OPTIONAL_COMPONENTS may be worthwhile but that is independent
from the proposed policy.
-Brad
More information about the cmake-developers
mailing list