[CMake] install files generator expression

Lars laasunde at hotmail.com
Wed Jan 9 06:28:59 EST 2019


Hello,

We use find_package command in config mode to find Qt 5.11 libraries. The libraries are available as imported (Qt5::Core etc).

Our understand is that CMake does not support install of imported targets. Therefore we use get_target_property to find actual location of library and Install(Files ...) to install the files.

The install command looks like this (and works);
INSTALL(FILES ${qt5_locations} DESTINATION "bin" COMPONENT runtime)

The documentation states that DESTINATION supports generator expression. We would like to use generator expression to install libraries in "bin" on Windows and "lib" on Linux but have not be able to accomplish this task. The below command generated the following error message "Install files given unknown argument  $<$<PLATFORM_ID:Linux>:lib>". We have tried other variants but none of them work.

INSTALL(FILES ${qt5_locations}
  DESTINATION
    $<$<PLATFORM_ID:Windows>:bin>
    $<$<PLATFORM_ID:Linux>:lib>
  COMPONENT runtime)

Appreicate any input.

kind regards, Lars


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190109/129e2d62/attachment.html>


More information about the CMake mailing list