Hi,

Should successive calls to find_package succeed in general?

Eg 

find_package(Grantlee COMPONENTS Templates)
find_package(Grantlee COMPONENTS TextDocument)

?

Currently if the target package uses Config files and 

install(TARGETS ... EXPORT)

the convention is to use

include(${CMAKE_CURRENT_LIST_DIR}/GrantleeTargets.cmake)

in the config file. The problem is that that Targets file uses an unguarded 

ADD_LIBRARY(grantlee_templates SHARED IMPORTED)

which cmake errors on:

  add_library cannot create imported target "grantlee_templates" because 
another target with the same name already exists.

The fix appears to be to wrap the call to add_library:

if (NOT TARGET grantlee_templates)
  ADD_LIBRARY(grantlee_templates SHARED IMPORTED)
endif()

I can fix this if it is a bug.

Thanks,

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to