MantisBT - CMake
View Issue Details
0005920CMakeModulespublic2007-10-20 20:232012-08-03 16:16
Miguel Figueroa 
Alex Neundorf 
urgentfeaturealways
closedfixed 
 
CMake 2.8.8 
0005920: Add support to handle COMPONENTS in FIND_PACKAGE_HANDLE_STANDARD_ARGS.
The attached patch adds a loop to check if all components passed through the FIND_PACKAGE COMPONENTS and REQUIRED options have been found and if not it will set XXX_FOUND to false.

XXX_YYY_FOUND should be set to TRUE for each component in the XXX_FIND_COMPONENTS list for the package to be found (i.e., XXX_FOUND = TRUE).

--Miguel
No tags attached.
patch FindPackageHandleStandardArgs.cmake.patch (1,144) 2007-10-20 20:23
https://public.kitware.com/Bug/file/1197/FindPackageHandleStandardArgs.cmake.patch
? FindPackageHandleStandardArgs.cmake.patch2 (1,612) 2007-12-18 08:18
https://public.kitware.com/Bug/file/1261/FindPackageHandleStandardArgs.cmake.patch2
? FindPackageHandleStandardArgs.cmake.patch3 (955) 2009-11-22 10:54
https://public.kitware.com/Bug/file/2684/FindPackageHandleStandardArgs.cmake.patch3
diff FindPackageHandleStandardArgs.cmake.diff (4,383) 2011-01-19 06:35
https://public.kitware.com/Bug/file/3643/FindPackageHandleStandardArgs.cmake.diff
Issue History
2007-10-20 20:23Miguel FigueroaNew Issue
2007-10-20 20:23Miguel FigueroaFile Added: FindPackageHandleStandardArgs.cmake.patch
2007-10-28 15:55Miguel FigueroaNote Added: 0009587
2007-10-28 15:55Miguel FigueroaPrioritynormal => urgent
2007-12-17 17:29Bill HoffmanStatusnew => assigned
2007-12-17 17:29Bill HoffmanAssigned To => Alex Neundorf
2007-12-18 08:18Miguel FigueroaFile Added: FindPackageHandleStandardArgs.cmake.patch2
2007-12-18 08:20Miguel FigueroaNote Added: 0009972
2008-01-02 12:39Alex NeundorfCategoryCMake => CCMake
2008-01-02 12:39Alex NeundorfCategoryCCMake => Modules
2008-02-06 17:04Alex NeundorfNote Added: 0010405
2009-11-22 10:54Alex NeundorfFile Added: FindPackageHandleStandardArgs.cmake.patch3
2009-11-22 10:55Alex NeundorfNote Added: 0018521
2009-12-14 17:05Alex NeundorfNote Added: 0018880
2011-01-19 06:35jzarlFile Added: FindPackageHandleStandardArgs.cmake.diff
2011-01-19 06:49jzarlNote Added: 0024905
2011-01-19 06:49jzarlNote Edited: 0024905bug_revision_view_page.php?bugnote_id=24905#r141
2012-08-03 16:16Alex NeundorfNote Added: 0030167
2012-08-03 16:16Alex NeundorfStatusassigned => closed
2012-08-03 16:16Alex NeundorfResolutionopen => fixed
2012-08-03 16:16Alex NeundorfFixed in Version => CMake 2.8.8

Notes
(0009587)
Miguel Figueroa   
2007-10-28 15:55   
I have raised the priority level on this, because I'm depending on this in two patches (for FindwxWidgets and FindImageMagick).

This issue was initially discussed here: http://www.cmake.org/pipermail/cmake/2007-October/017076.html [^]

Alex Neundorf agrees that the patch is reasonable, but we would like input from other CMake developers. I can apply the patch and support/maintain any arising issues, but I don't want to abuse my cvs write access. Hence, if this bug is assigned to me I'll apply the patch, otherwise I'll expect someone else to decide on it.

--Miguel
(0009972)
Miguel Figueroa   
2007-12-18 08:20   
I've attached another patch that includes the change from a MACRO to a FUNCTION. This is to be used by many find modules and we are only interested in setting XXX_FOUND and the success/failure messages. Hence, all the local variables should be in fact local.

--Miguel
(0010405)
Alex Neundorf   
2008-02-06 17:04   
I committed the part which changes the macro to a function.
About the other change: this means FOO_FOUND is only set to TRUE if all components have been found, right ?
Is this the expected behaviour ?
I'm not sure. Does Modules/readme.txt say something about this ?

Alex
(0018521)
Alex Neundorf   
2009-11-22 10:55   
Uploaded updated version of the patch.

Currently I feel a bit unsure about this patch, because it changes the behaviour of an existing macro. With this change, find_package_handle_standard_args() can now return FALSE where it returned TRUE before.

Alex
(0018880)
Alex Neundorf   
2009-12-14 17:05   
Not sure this is necessary.
You could also do a nested approach for that e.g. in a FindBlub.cmake:

set(BLUB_REQUIRED_COMPONENTS_RESULTS)
if( Blub_FIND_COMPONENTS )
  foreach( _component ${Blub_FIND_COMPONENTS} )
    set(BLUB_REQUIRED_COMPONENTS_RESULTS ${BLUB_REQUIRED_COMPONENTS_RESULTS}
                                          BLUB_${_component}_FOUND)
  endforeach( _component )
endif( BLUB_FIND_COMPONENTS )

find_package_handle_standard_args(Blub_Foo DEFAULT_MSG FOO_LIBRARY)
find_package_handle_standard_args(Blub_Bar DEFAULT_MSG BAR_LIBRARY)

find_package_handle_standard_args(Blub DEFAULT_MSG BLUB_LIBRARY
                                        ${BLUB_REQUIRED_COMPONENTS_RESULTS})


Dealing with the Blub_FIND_COMPONENTS could still be made easier with some macro I think.

Alex
(0024905)
jzarl   
2011-01-19 06:49   
I have uploaded a patch that allows to specify component-specific variables using the following syntax:

find_package_handle_standard_args (NAME [REQUIRED_VARS <var1>...<varN>]
     [COMPONENTS
        [COMPONENT <cname> <cvar1>..<cvarN> [COMPONENT <cname> <cvar1>..<cvarN>[..]]]
        [[NO_]CHECK_REQUESTED_COMPONENTS]
     ]
     [VERSION_VAR <versionvar>
     [CONFIG_MODE]
     [FAIL_MESSAGE "Custom failure message"] )

For the above example by Alex, the syntax would look like this:
find_package_handle_standard_args(Blub REQUIRED_VARS BLUB_LIBRARY COMPONENTS COMPONENT Foo FOO_LIBRARY COMPONENT Bar BAR_LIBRARY)

The original post on the mailing list is here: http://www.cmake.org/pipermail/cmake/2010-December/041361.html [^]

  Johannes

(0030167)
Alex Neundorf   
2012-08-03 16:16   
Since 2.8.8 find_package_handle_standard_args() (and find_package() itself) have improved support for components, so I'm closing this one.
You can now say
find_package_handle_standard_args(... HANDLE_COMPONENTS ...)
and it will take care of them, see the documentation for details.