Skip to content

Commit

Permalink
Add configure option FCL_NO_DEFAULT_RPATH
Browse files Browse the repository at this point in the history
The currently used compiler settings explicitly set RPATH to
installed binaries which is not desired behaviour in some
circumstances, e.g. OpenEmbedded's QA checks report an issue
about redundant RPATH set to the standard '/usr/lib' directory.

This patch adds the configure option FCL_NO_DEFAULT_RPATH which is
ON by default in order to preserve the current behaviour, but
when set to OFF make CMake use its default RPATH settings, that is
set RPATH for the binaries in the build tree, but clear them out
for installed binaries.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
  • Loading branch information
Dmitry Rozhkov committed Feb 7, 2017
1 parent b05b569 commit 9a84f63
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions CMakeModules/CompilerSettings.cmake
Expand Up @@ -77,11 +77,20 @@ if((CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) AND NOT MINGW)
endif()
endif()

# By default CMake sets RPATH for binaries in the build tree, but clears
# it when installing. Switch this option off if the default behaviour is
# desired.
option(FCL_NO_DEFAULT_RPATH "Set RPATH for installed binaries" ON)
mark_as_advanced(FCL_NO_DEFAULT_RPATH)

# Set rpath http://www.paraview.org/Wiki/CMake_RPATH_handling
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR_FULL}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(FCL_NO_DEFAULT_RPATH)
message(STATUS "Set RPATH explicitly to '${CMAKE_INSTALL_LIBDIR_FULL}'")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR_FULL}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

# no prefix needed for python modules
set(CMAKE_SHARED_MODULE_PREFIX "")

0 comments on commit 9a84f63

Please sign in to comment.