[CMake]: Patch for FIND_PACKAGE_HANDLE_STANDARD_ARGS

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sat Oct 20 20:31:31 EDT 2007


I have created a feature request #5920 for the following issue. I
won't apply the changes myself unless I'm assigned the feature, since
I don't want to abuse my cvs modules access.

On 10/19/07, Alex Neundorf wrote:
> On Thursday 18 October 2007 21:25, Miguel A. Figueroa-Villanueva wrote:
> > - create a macro in the same line of
> > FIND_PACKAGE_HANDLE_STANDARD_ARGS(...), and possibly in the same file,
> > that checks if all components are found to set the main variable:
> >
> > FIND_PACKAGE_HANDLE_STANDARD_COMPONENTS(ImageMagick)
> >
> > would basically do a:
> >
> > # check if all components are found to set XXX_FOUND
> > SET(XXX_FOUND TRUE)
> > FOREACH (component ${XXX_FIND_COMPONENTS})
> >   IF (NOT XXX_${component}_FOUND)
> >     SET(XXX_FOUND FALSE)
> >   ENDIF (NOT XXX_${component}_FOUND)
> > ENDFOREACH (component)
>
> Maybe this loop could also just be added to the
> FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro ?
> If no components are specified, then there will be no change in behaviour,
> right ?

Yes, good point. I added this loop to the
FIND_PACKAGE_HANDLE_STANDARD_ARGS macro and tested it. It seems to
work well and should have no conflicts the patch for it is in the
feature request (and the loop copied below for easier reference):

http://www.cmake.org/Bug/view.php?id=5920

--Miguel

--------------
Basically, the patch adds the following loop:

  # check if all components are found (specified with COMPONENT|REQUIRED)
  FOREACH(_CURRENT_VAR ${${_NAME}_FIND_COMPONENTS})
    IF(NOT ${_NAME}_${_CURRENT_VAR}_FOUND)
      SET(${_NAME_UPPER}_FOUND FALSE)
    ENDIF(NOT ${_NAME}_${_CURRENT_VAR}_FOUND)
  ENDFOREACH(_CURRENT_VAR)


More information about the CMake mailing list