View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005920CMakeModulespublic2007-10-20 20:232012-08-03 16:16
ReporterMiguel Figueroa 
Assigned ToAlex Neundorf 
PriorityurgentSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionCMake 2.8.8 
Summary0005920: Add support to handle COMPONENTS in FIND_PACKAGE_HANDLE_STANDARD_ARGS.
DescriptionThe 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
TagsNo tags attached.
Attached Filespatch file icon FindPackageHandleStandardArgs.cmake.patch [^] (1,144 bytes) 2007-10-20 20:23 [Show Content]
? file icon FindPackageHandleStandardArgs.cmake.patch2 [^] (1,612 bytes) 2007-12-18 08:18
? file icon FindPackageHandleStandardArgs.cmake.patch3 [^] (955 bytes) 2009-11-22 10:54
diff file icon FindPackageHandleStandardArgs.cmake.diff [^] (4,383 bytes) 2011-01-19 06:35 [Show Content]

 Relationships

  Notes
(0009587)
Miguel Figueroa (developer)
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 (developer)
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 (developer)
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 (developer)
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 (developer)
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 (reporter)
2011-01-19 06:49
edited on: 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 (developer)
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.

 Issue History
Date Modified Username Field Change
2007-10-20 20:23 Miguel Figueroa New Issue
2007-10-20 20:23 Miguel Figueroa File Added: FindPackageHandleStandardArgs.cmake.patch
2007-10-28 15:55 Miguel Figueroa Note Added: 0009587
2007-10-28 15:55 Miguel Figueroa Priority normal => urgent
2007-12-17 17:29 Bill Hoffman Status new => assigned
2007-12-17 17:29 Bill Hoffman Assigned To => Alex Neundorf
2007-12-18 08:18 Miguel Figueroa File Added: FindPackageHandleStandardArgs.cmake.patch2
2007-12-18 08:20 Miguel Figueroa Note Added: 0009972
2008-01-02 12:39 Alex Neundorf Category CMake => CCMake
2008-01-02 12:39 Alex Neundorf Category CCMake => Modules
2008-02-06 17:04 Alex Neundorf Note Added: 0010405
2009-11-22 10:54 Alex Neundorf File Added: FindPackageHandleStandardArgs.cmake.patch3
2009-11-22 10:55 Alex Neundorf Note Added: 0018521
2009-12-14 17:05 Alex Neundorf Note Added: 0018880
2011-01-19 06:35 jzarl File Added: FindPackageHandleStandardArgs.cmake.diff
2011-01-19 06:49 jzarl Note Added: 0024905
2011-01-19 06:49 jzarl Note Edited: 0024905
2012-08-03 16:16 Alex Neundorf Note Added: 0030167
2012-08-03 16:16 Alex Neundorf Status assigned => closed
2012-08-03 16:16 Alex Neundorf Resolution open => fixed
2012-08-03 16:16 Alex Neundorf Fixed in Version => CMake 2.8.8


Copyright © 2000 - 2018 MantisBT Team