diff --git a/ci/tests/ci-tests.sh b/ci/tests/ci-tests.sh index 73c724db86..3a7b269ab7 100755 --- a/ci/tests/ci-tests.sh +++ b/ci/tests/ci-tests.sh @@ -117,9 +117,8 @@ test_supported_features() { library_path="${BOTAN_INSTALL}/$so_folder:${JSONC_INSTALL}/$so_folder:${RNP_INSTALL}/$so_folder" fi - if [[ "$OSTYPE" == darwin* ]]; then - export DYLD_LIBRARY_PATH="$library_path${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}" - else + # For darwin we assume that LC_RPATH is added with @executable_dir/../lib + if [[ ! "$OSTYPE" == darwin* ]]; then export LD_LIBRARY_PATH="$library_path${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" fi diff --git a/src/rnp/CMakeLists.txt b/src/rnp/CMakeLists.txt index d3199e7e1f..97784b1668 100644 --- a/src/rnp/CMakeLists.txt +++ b/src/rnp/CMakeLists.txt @@ -59,6 +59,14 @@ add_executable(rnp if(BUILD_SHARED_LIBS) target_sources(rnp PRIVATE ../lib/logging.cpp $) + + if(APPLE) + # Since cmd line tools version 2397 dyld doesn't look in ../lib + # See issue #2153 and https://developer.apple.com/forums/thread/737920 for the details. + set_target_properties(rnp PROPERTIES + INSTALL_RPATH "@executable_path/../lib" + ) + endif(APPLE) endif(BUILD_SHARED_LIBS) target_include_directories(rnp diff --git a/src/rnpkeys/CMakeLists.txt b/src/rnpkeys/CMakeLists.txt index 6302903a02..9010ca4a9d 100644 --- a/src/rnpkeys/CMakeLists.txt +++ b/src/rnpkeys/CMakeLists.txt @@ -60,6 +60,14 @@ add_executable(rnpkeys if(BUILD_SHARED_LIBS) target_sources(rnpkeys PRIVATE ../lib/logging.cpp $) + + if(APPLE) + # Since cmd line tools version 2397 dyld doesn't look in ../lib + # See issue #2153 and https://developer.apple.com/forums/thread/737920 for the details. + set_target_properties(rnpkeys PROPERTIES + INSTALL_RPATH "@executable_path/../lib" + ) + endif(APPLE) endif(BUILD_SHARED_LIBS) target_include_directories(rnpkeys