diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 08b69aa413..9fb9233659 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -262,7 +262,8 @@ endif(MSVC) ############################################################################# if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set_target_properties(ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_FINAL_INSTALL_PATH};.") + # tell binary to first attempt to load libraries from its own directory + set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN") # Find Qt libraries and sym links file (GLOB RESINSIGHT_FILES @@ -275,6 +276,9 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + # put a .exe.local file in the target directory to pick up DLLs from there + install (CODE "exec_program (${CMAKE_COMMAND} ARGS -E touch \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}${RESINSIGHT_FINAL_NAME}/ResInsight${CMAKE_EXECUTABLE_SUFFIX}.local)") + set (RESINSIGHT_FILES ${QT_BINARY_DIR}/QtCore4.dll ${QT_BINARY_DIR}/QtGui4.dll diff --git a/CMakeLists.txt b/CMakeLists.txt index 1770942634..4a8ca92a40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,10 +114,8 @@ if (NOT "${RESINSIGHT_PLATFORM}" STREQUAL "") set (RESINSIGHT_FINAL_NAME "${RESINSIGHT_FINAL_NAME}-${RESINSIGHT_PLATFORM}") endif() -set (RESINSIGHT_FINAL_INSTALL_PATH "/usr/${RESINSIGHT_FINAL_NAME}") - set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/) -#set (CMAKE_INSTALL_PREFIX ${RESINSIGHT_FINAL_INSTALL_PATH}) +#set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME}) ################################################################################ # Application diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index 507f3bfa75..45fbe8b316 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -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")