diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index 405fd7fc9f884f59dcf47f8f9bb9727d9b8c4b16..a439e436e7b87356c01228bf22961dcff9974c12 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -64,8 +64,8 @@ endif() # See our deployment paper (Nejati et al 2024) for explanation. if(LINUX) - target_link_options(${executable_name} PRIVATE - "-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib") + set(link_flags "-Wl,-rpath,\$ORIGIN/../lib") + set_target_properties(${executable_name} PROPERTIES LINK_FLAGS ${link_flags}) elseif(APPLE) set(MACOSX_BUNDLE_IDENTIFIER org.bornagainproject.BornAgain) configure_file(${CONFIGURABLES_DIR}/MacOSXBundleInfo.plist.in ${BUILD_VAR_DIR}/Info.plist @ONLY) diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index c2032c11f86982348ea629d40efbc19a95b6eb7d..7d2329a57f586928f79fcc07a76db83dee475dde 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -31,6 +31,11 @@ set(BornAgain_LIBRARIES "$CACHE{BornAgain_LIBRARIES};${lib_dir}/${libprefix}${li # switch OFF Qt debug output in any configuration except DEBUG target_compile_definitions(${lib} PUBLIC $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT>) +if(LINUX) + set(link_flags "-Wl,-rpath,\$ORIGIN") + set_target_properties(${lib} PROPERTIES LINK_FLAGS ${link_flags}) +endif(LINUX) + if(BORNAGAIN_PYTHON) target_compile_definitions(${lib} PRIVATE -DBORNAGAIN_PYTHON) endif() diff --git a/cmake/BornAgain/MakeLib.cmake b/cmake/BornAgain/MakeLib.cmake index 22678e602dbf06db711bcddb75be68719c53c544..316e097b3937e2151e1a0b0656902bb338e98b26 100644 --- a/cmake/BornAgain/MakeLib.cmake +++ b/cmake/BornAgain/MakeLib.cmake @@ -68,8 +68,8 @@ function(MakeLib lib swigtmpdir source_files include_files) # Set runtime-location of library dependencies # See our deployment paper (Nejati et al 2024) for explanation. if(LINUX) - target_link_options(${lib} PRIVATE - "-Wl,--disable-new-dtags,-rpath,\$ORIGIN:\$ORIGIN/extra") + set(link_flags "-Wl,--disable-new-dtags,-rpath,\$ORIGIN:\$ORIGIN/../extra") + set_target_properties(${lib} PROPERTIES LINK_FLAGS ${link_flags}) elseif(APPLE) target_link_options(${lib} PRIVATE "-Wl,-rpath,@loader_path,-rpath,@loader_path/extra")