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

Nils Gladitz nilsgladitz at gmail.com
Sat Sep 12 09:30:58 EDT 2015


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