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

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Oct 28 11:04:33 EDT 2009


Hum, let's try again. I'd like to know if there is an API to query
properties of 'mylib-targets' as in:

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)

get_???_property(my_targets mylib-targets TARGETS)

I'd like to list all TARGETS associated with mylib-targets. This will
greatly ease generating a UseProject.cmake file.

Thanks

On Fri, Oct 23, 2009 at 4:28 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> 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
>



-- 
Mathieu


More information about the CMake mailing list