[CMake] Why is target installation done in 2 separate steps?

Tamás Kenéz tamas.kenez at gmail.com
Wed Jul 20 16:26:52 EDT 2016


I believe you can install and assign multiple targets in different
subdirectories to a single export:

/foo/CMakeLists.txt:
    install(TARGETS foo EXPORT mylib-targets ...)

/bar/CMakeLists.txt
    install(TARGETS bar EXPORT mylib-targets ...)

/CMakeLists.txt
    install(EXPORT mylib-targets ...)

On Mon, Jul 11, 2016 at 12:26 AM, Robert Dailey <rcdailey.lists at gmail.com>
wrote:

> Documentation states, that to export a file that imports your targets,
> you must do roughly:
>
> install(TARGETS fubar EXPORT fubar-targets)
> install(EXPORT fubar-targets DESTINATION lib/cmake/fubar)
>
> Why is this done in two steps? Based on reading the install()
> documentation, I don't see how the install(TARGETS) command is useful
> without the corresponding install(EXPORT).
>
> Can someone explain why these are separate commands instead of 1
> complete command? Thanks in advance.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160720/3a4e196e/attachment.html>


More information about the CMake mailing list