Use $ORIGIN to load libs from program directory

The RPATH attribute won't expand relative directories (such as ".")
neither can it be a semi-colon separated list; the old way of setting
it was wrong and would lead to libraries being loaded from system
directories instead.
This commit is contained in:
Roland Kaufmann
2013-03-26 22:20:14 +01:00
parent 8c999fc481
commit e63c609111
3 changed files with 8 additions and 5 deletions

View File

@@ -8,7 +8,8 @@ set(CPP_SOURCES
)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(RPATH_COMMAND "-Wl,-rpath=${RESINSIGHT_FINAL_INSTALL_PATH} -Wl,-rpath=.")
# since the compiler passes the option to the linker, double quoting is necessary
set (RPATH_COMMAND "-Wl,-rpath,'\\$$ORIGIN'")
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")