[CMake] do not hardcode system library absolute path

David Froger david.froger.ml at mailoo.org
Sun Aug 30 04:41:12 EDT 2015


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?

Thanks,
David


More information about the CMake mailing list