Clinton Stimpson wrote:

> On Wednesday, June 22, 2011 10:01:37 am Stephen Kelly wrote:
>> Hi,
>> 
>> In my GrantleeConfigVersion.cmake.in I can use ${PACKAGE_FIND_VERSION}
>> which I presume is filled from the find_package command (I just copied
>> the file from elsewhere).
>> 
>> Is there an equivalent for COMPONENTS so that if someone does a
>> 
>> find_package(Grantlee COMPONENTS Foo Bar)
>> 
>> my config file would do something like:
>> 
>> if (${PACKAGE_FIND_COMPONENTS} CONTAINS "Foo")
>>    # Find the dependencies of Foo
>> endif()
>> 
>> if (${PACKAGE_FIND_COMPONENTS} CONTAINS "Bar")
>>    # Find the dependencies of Bar
>> endif()
>> 
> 
> You can use Grantlee_FIND_COMPONENTS which would contain the components
> passed in by the user.
> 
> Here's an example of using it:
> 
> ...
> # the Grantlee exports file to accompany this config auto generated by
> # cmake's export() if this config is used in the build tree,
> # or install(EXPORT ...) if used in the installation tree
> SET(GrantleeExportsFile "@GrantleeExportsFile@")
> ...
> 
> include("${GrantleeExportsFile}")
> 
> # check that the user requested components
> # are actually targets that are part of this build
> IF( Grantlee_FIND_COMPONENTS )
>   FOREACH(comp ${Grantlee_FIND_COMPONENTS})
>     if(NOT TARGET ${comp})
>       SET(Grantlee_${comp}_FOUND 0)
>       IF(Grantlee_FIND_REQUIRED_${comp})
>         MESSAGE(FATAL_ERROR "Grantlee ${comp} not available.")
>       ENDIF()
>     ELSE()
>       SET(Grantlee_${comp}_FOUND 1)
>     ENDIF()
>   ENDFOREACH()
> ENDIF()
> 

Thanks, this looks like what I need alright.

Steve.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to