[cmake-developers] Package Config files with COMPONENTS
Brad King
brad.king at kitware.com
Mon Mar 19 11:03:20 EDT 2012
On 3/18/2012 4:41 PM, Alexander Neundorf wrote:
> 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.
Thanks. I rewrote the topic on the stage to clean up the history a little
and rebase it on top of the rewritten version of the other
find_package_set_FOUND_VariableInConfigFile topic.
I tweaked the documentation of component support in find_package to make it
clear that each package is responsible for dealing with components, just as
is already stated for version support. I also adjusted the formatting of
the required+optional component error message and added a test for it.
Please take a look at the new version of the topic.
> 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.
If projects use such complex logic to choose the list of components then
it is their responsibility to filter them to avoid duplicates. The
list(REMOVE_ITEM) command can easily clean up duplicates.
-Brad
More information about the cmake-developers
mailing list