@@ -126,10 +126,15 @@ endfunction()
126
126
127
127
function (install_bundled_binaries )
128
128
set (options )
129
- set (oneValueArgs DESTINATION TARGET )
129
+ set (oneValueArgs DESTINATION TARGET WRITE_RPATH )
130
130
set (multiValueArgs BINARIES )
131
131
cmake_parse_arguments (INSTALL_BUNDLED "${options} " "${oneValueArgs} " "${multiValueArgs} " ${ARGN} )
132
132
133
+ if (NOT DEFINED INSTALL_BUNDLED_WRITE_RPATH )
134
+ # if not explicitly specified, we always add an RPATH
135
+ set (INSTALL_BUNDLED_WRITE_RPATH TRUE )
136
+ endif ()
137
+
133
138
if (WIN32 AND (INSTALL_BUNDLED_DESTINATION STREQUAL INSTALL_LIBDIR OR INSTALL_BUNDLED_DESTINATION MATCHES "^${INSTALL_LIBDIR} /.*" ))
134
139
# on Windows, if files should be installed in the 'lib' directory, we install them in the 'bin' directory instead
135
140
set (INSTALL_BUNDLED_DESTINATION "${INSTALL_BINDIR} " )
@@ -141,8 +146,9 @@ function(install_bundled_binaries)
141
146
if (NOT IS_SYMLINK "${SOURCE_BINARY} " )
142
147
message (STATUS "Bundling binary: ${SOURCE_BINARY} , installation directory: ${INSTALL_BUNDLED_DESTINATION} " )
143
148
if (LINUX )
144
- # we always add an RPATH, if we bundle a binary, then for sure it is going to use one of the other libraries
145
- write_rpath (BINARY "${SOURCE_BINARY} " DESTINATION "${INSTALL_BUNDLED_DESTINATION} " TARGET ${INSTALL_BUNDLED_TARGET} )
149
+ if (INSTALL_BUNDLED_WRITE_RPATH )
150
+ write_rpath (BINARY "${SOURCE_BINARY} " DESTINATION "${INSTALL_BUNDLED_DESTINATION} " TARGET ${INSTALL_BUNDLED_TARGET} )
151
+ endif ()
146
152
elseif (APPLE )
147
153
# if we bundle OpenSSL, then we want the bundled binary to use it instead of the system one
148
154
if (BUNDLED_OPENSSL )
0 commit comments