Use --enable-new-dtags to set RUNPATH rather than RPATH so that LD_LIBRARY_PATH is not overridden by the application.

This commit is contained in:
Sam Lantinga
2016-01-07 16:42:30 -08:00
parent 73680ab374
commit dc5f05bb99
3 changed files with 49 additions and 0 deletions

View File

@@ -958,6 +958,12 @@ elseif(UNIX AND NOT APPLE)
set(SDL_RLD_FLAGS "")
if(BSDI OR FREEBSD OR LINUX OR NETBSD)
set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}")
set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags")
check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
if(HAVE_ENABLE_NEW_DTAGS)
list(APPEND SDL_RLD_FLAGS "-Wl,--enable-new-dtags")
endif()
elseif(SOLARIS)
set(SDL_RLD_FLAGS "-R\${libdir}")
endif()