Dear cmake users, I have found good documentation on the cmake wiki about RPATH and its different variables, and also on the mailing lists. But somehow it still does not add up for me. Can you please help?
I use cmake 3.9.5 on different platforms, CentOS 6 and Ubuntu 14.04 amongst others. I build many standard libraries (like tiff and jpeg) into my own thirdparty directory, and set CMAKE_PREFIX_PATH to find them there. On newer Linux and Windows, cmake uses always the absolute path to those libraries, and everything works fine. But on older Linux like Ubuntu 14.04 and CentOS 6 it does not. cmake will first find the library in the correct absolute thirdparty directory, and I can confirm this by printing the 'XXX_LIBRARIES' variable in the find script. But later the Makefile will link with '-lxxx' instead of the full path. This makes 'ld' use the system library instead! I completely fail to understand at what point cmake changes XXX_LIBRARIES from an absolute path to '-lxxx', for example for libjpeg. I have experimented with CMAKE_SKIP_BUILD_RPATH, but it does not help. The only workaround I could find is to add the thirdparty directory to LDFLAGS. Then 'ld' will also find the correct library. Is this a bug, or an expected behavior? What parameters should I add when I invoke cmake so that it will always use libraries with their full path? Cheers, Mario Emmenlauer PS: since I build thirdparty libraries, I prefer not to change their CMakeLists.txt but would rather prefer to set better cmake command line parameters. References: https://cmake.org/Wiki/CMake_RPATH_handling https://cmake.org/pipermail/cmake/2015-September/061462.html -- BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203 Balanstr. 43 mailto: memmenlauer * biodataanalysis.de D-81669 München http://www.biodataanalysis.de/ -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake