[cmake-developers] Should sucessive calls to find_package for one package succeed?

Stephen Kelly steveire at gmail.com
Mon Nov 7 10:18:53 EST 2011


Brad King wrote:

> On 11/6/2011 7:00 PM, Stephen Kelly wrote:
>> include(${CMAKE_CURRENT_LIST_DIR}/GrantleeTargets.cmake)
> 
> It is up to the author of the config file to block this correctly
> against multiple inclusion, e.g.
> 
>   if(NOT Grantlee_TARGETS_INCLUDED)
>     set(Grantlee_TARGETS_INCLUDED 1)
>     include(${CMAKE_CURRENT_LIST_DIR}/GrantleeTargets.cmake)
>   endif()

Ok, thanks. Seems like an important thing to document. Is there any page 
showing how to use config files and targets files? I only found out how to 
use them by talking to Alex :).

> 
>> if (NOT TARGET grantlee_templates)
>>    ADD_LIBRARY(grantlee_templates SHARED IMPORTED)
>> endif()
> 
> This would hide cases of accidentally conflicting target names.
> 

I don't understand. You mean if someone called install(EXPORTS) with the 
wrong target? 

Thanks,

Steve.







More information about the cmake-developers mailing list