[CMake] do not hardcode system library absolute path
Eric Noulard
eric.noulard at gmail.com
Sun Aug 30 05:31:00 EDT 2015
2015-08-30 10:41 GMT+02:00 David Froger <david.froger.ml at mailoo.org>:
> Hi,
>
> When CMake exports libraries that depend on system library, absolute path
> to
> these system libraries are hardcoded in CMakefile configuration files.
>
> For example, when building and installing ITK, the file
> lib/cmake/ITK-4.7ITKTargets-release.cmake is installed and contain
> a reference to /usr/lib64/libm.so .
>
> My problem is that I want to build a conda package for ITK on Centos OS
> 5.11,
> then install this ITK package on Ubuntu 14.04, and link with ITK libraries.
>
> But it fails as libm is search in /usr/lib64/libm.so instead of
> /lib/x86_64-linux-gnu/libm.so.6 .
>
> Here is a minimal example to reproduce the problem without ITK:
> https://github.com/dfroger/gravitation
>
> Is there an way in CMake to export libraries without absolute path to
> dependant system libraries?
>
I guess that you can set INSTALL_RPATH on a particular target that needs it;
see
http://www.cmake.org/Wiki/CMake_RPATH_handling
and
http://www.cmake.org/cmake/help/v3.0/prop_tgt/INSTALL_RPATH.html
http://www.cmake.org/cmake/help/v3.0/prop_tgt/INSTALL_RPATH_USE_LINK_PATH.html
--
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150830/44ab2228/attachment.html>
More information about the CMake
mailing list