[cmake-developers] Package Config files with COMPONENTS
Alexander Neundorf
neundorf at kde.org
Sun Mar 18 16:41:19 EDT 2012
On Tuesday 13 March 2012, Brad King wrote:
> On 3/13/2012 5:10 PM, Alexander Neundorf wrote:
> > Regarding the error: I think (didn't check) right now cmake doesn't
> > complain if I list a component multiple times:
> >
> > find_package(Foo COMPONENTS bar blub bar)
>
> I don't think it does.
>
> > If it doesn't, then I'd say
> >
> > find_package(Foo COMPONENTS bar blub OPTIONAL_COMPONENTS bar)
> >
> > maybe also should not lead to an error.
>
> It is a new option so we can have new behavior ;)
>
> It can simply be an error to be in BOTH but not to repeat in one
> or the other.
>
> -Brad
This is now in the ImprovedCOMPONENTSSupportInFindPackage2 branch on stage.
It adds an OPTIONAL_COMPONENTS option to find_package().
It adds an option HANDLE_COMPONENTS to FPHSA(), so FPHSA() checks whether all
requested required components have been found (doing this by default might
break existing find-modules).
It adds a macro check_required_components() to @PACKAGE_INIT@, configured
using configure_package_config_file()
It also adds documentation and testing.
Listing a component both as COMPONENT and as OPTIONAL_COMPONENT is not
allowed, cmake errors out then (3f9acd827da99ca581). I'm not sure this is
good, maybe this list is created programmatically using dependent components,
so maybe both a required and an optional component require and additional
component, which is then maybe handed down to a find_package(NO_MODULE) call.
Then we would have duplicated entries.
I'd prefer "required overrides optional".
Please review.
Alex
More information about the cmake-developers
mailing list