[cmake-developers] Package Config files with COMPONENTS

Brad King brad.king at kitware.com
Tue Mar 13 15:51:01 EDT 2012


On 3/13/2012 3:25 PM, Alexander Neundorf wrote:
> How about this:
> * no policy
> * new argument find_package( OPTIONAL_COMPONENTS), so we get two sets of
> components
> * the components are still ignored by find_package() for setting Foo_FOUND
> * I add some code to FPHSA so it handled COMPONENTS and REQUIRED_COMPONENTS as
> done in my branch (i.e. COMPONENTS are required, OPTIONAL_COMPONENTS not)
> * I maybe add something to @PACKAGE_INIT@ to help Config files handle
> components as recommended
>
> This way we could recommend to handle components in some way, and make it easy
> for developers to follow the recommendation.

Sounds good!

Rather than two separate lists of components perhaps the

  <pkg>_FIND_REQUIRED_<component>

variables could have the value "OPTIONAL" instead of "1" when a
given component is optional.  This will probably simplify code
dealing with components because it needs to loop over only one
list and won't have to worry about whether a component can appear
in both lists.

Thanks,
-Brad



More information about the cmake-developers mailing list