[CMake] install EXPORT uses absolute paths on Windows, making libraries not relocatable

Wojtek Mamrak wmamrak at gmail.com
Sat Sep 12 18:25:17 EDT 2015


I must have missed that, thanks!

2015-09-12 15:30 GMT+02:00 Nils Gladitz <nilsgladitz at gmail.com>:
> On 12.09.2015 15:04, Wojciech Mamrak wrote:
>>
>> install(TARGETS foo
>>          EXPORT FooTargets
>>          ARCHIVE DESTINATION "${INSTALL_LIBDIR}")
>
>
> Your target's install DESTINATION is absolute which is why the exported
> location is absolute as well.
>
> e.g. using "DESTINATION lib" instead of "DESTINATION /foo/bar/lib" should
> make both your install and export relative (relocatable).
> For the regular "install" target install destinations are appended to
> CMAKE_INSTALL_PREFIX[1].
>
> Nils
>
> [1] http://www.cmake.org/cmake/help/v3.3/variable/CMAKE_INSTALL_PREFIX.html


More information about the CMake mailing list