[CMake] Packaging and Exporting: Generating the UsePROJECT.cmake file ?

Mathieu Malaterre mathieu.malaterre at gmail.com
Fri Oct 23 11:28:39 EDT 2009


Hi there,

  I am still working on Packaging and Exporting:
http://www.cmake.org/Wiki/CMake_2.6_Notes#Packaging_and_Exporting

  I'd like to know if there is a neat function to loop over all
libraries that are imported (typically for a Use*.cmake file).

Eg.

add_library(mylib SHARED mylib.c mylib.h)
add_library(mylib2 SHARED mylib.c mylib.h)
install(TARGETS mylib mylib2 DESTINATION lib/myproj EXPORT mylib-targets)
install(EXPORT mylib-targets DESTINATION lib/myproj)

Creates a mylib-targets.cmake:
...
ADD_LIBRARY(mylib SHARED IMPORTED)
ADD_LIBRARY(mylib2 SHARED IMPORTED)
...


is there a way to retrieve those imported libraries in a variable
called -say- "mylib_LIBRARIES", or do I have to construct this
variable myself ?

Thanks !
-- 
Mathieu


More information about the CMake mailing list