Skip to content

Commit 371d498

Browse files
committed
Don't set RPATH settings if they've already been defined.
1 parent 63fe2f6 commit 371d498

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

cmake/SC_Build_opts.cmake

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,33 @@ endif(SC_SKIP_EXEC_INSTALL)
103103
# http://www.cmake.org/Wiki/CMake_RPATH_handling
104104

105105
# use, i.e. don't skip the full RPATH for the build tree
106-
set(CMAKE_SKIP_BUILD_RPATH FALSE)
106+
if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH)
107+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
108+
endif()
107109

108110
# when building, don't use the install RPATH already
109111
# (but later on when installing)
110-
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
112+
if(NOT DEFINED CMAKE_BUILD_WITH_INSTALL_RPATH)
113+
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
114+
endif()
111115

112116
# the RPATH/INSTALL_NAME_DIR to be used when installing
113117
if (NOT APPLE)
114-
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
118+
if(NOT DEFINED CMAKE_INSTALL_RPATH)
119+
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
120+
endif()
115121
endif(NOT APPLE)
116122
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
117123
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
118-
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
124+
if(NOT DEFINED CMAKE_INSTALL_NAME_DIR)
125+
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
126+
endif()
119127

120128
# add the automatically determined parts of the RPATH which point to
121129
# directories outside the build tree to the install RPATH
122-
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
130+
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
131+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
132+
endif()
123133

124134
# When this is a subbuild, assume that the parent project controls all of the following
125135
#======================================================================================

0 commit comments

Comments
 (0)