Do not set rpath when binaries are installed in the standard search path
authorvittorio.giovara@gmail.com
Mon, 27 Apr 2015 17:21:58 +0000
changeset 10911 5e3f42553ebc
parent 10910 df11dea74701
child 10916 2df1c53b30ea
Do not set rpath when binaries are installed in the standard search path $ rpmlint hedgewars hedgewars.i686: E: binary-or-shlib-defines-rpath /usr/bin/hwengine ['$ORIGIN/../lib/', '$ORIGIN/', '/usr/lib/'] hedgewars.i686: E: binary-or-shlib-defines-rpath /usr/lib/libphyslayer.so ['$ORIGIN/../lib/', '$ORIGIN/', '/usr/lib/'] hedgewars.i686: E: binary-or-shlib-defines-rpath /usr/bin/hedgewars ['$ORIGIN/../lib/', '$ORIGIN/', '/usr/lib/']
cmake_modules/paths.cmake
--- a/cmake_modules/paths.cmake	Sat Apr 11 17:37:43 2015 +0300
+++ b/cmake_modules/paths.cmake	Mon Apr 27 17:21:58 2015 +0000
@@ -60,11 +60,12 @@
     set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
     #install_name_tool for libraries
     set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
-else(APPLE)
+else(APPLE AND NOT (${CMAKE_INSTALL_PREFIX} MATCHES "/usr"))
     #paths where to find libraries (final slash not optional):
     # - the first is relative to the executable
     # - the second is the same directory of the executable (so it runs in bin/)
     # - the third one is the full path of the system dir
     #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
+    #skip this if the install prefix is the standard one
     set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
 endif(APPLE)