[cmake-developers] Package Config files with COMPONENTS
Alexander Neundorf
neundorf at kde.org
Tue Mar 13 12:59:12 EDT 2012
On Tuesday 13 March 2012, Brad King wrote:
> 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?
It should.
This branch is currently only a first step, to see how it would look like.
> > * 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.
Some users/developers would prefer if there was a more strict definition of
how the COMPONENTS arguments should be handled.
> This will be possible after the topic
> find_package_set_FOUND_VariableInConfigFile is done.
Yes. That's why I did this small branch first and with as few changes in
behaviour as possible.
> I think OPTIONAL_COMPONENTS may be worthwhile but that is independent
> from the proposed policy.
Hmm, but without the policy change (set Foo_FOUND only TRUE if all requested
COMPONENTS have been found), OPTIONAL_COMPONENTS does not really make a lot of
sense, since both will then simply result in two different cmake variables
Foo_FIND_OPTIONAL_COMPONENTS and Foo_FIND_COMPONENTS, and both lists are still
handled the same way, i.e. ignored for setting Foo_FOUND.
Alex
More information about the cmake-developers
mailing list