diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt --- a/openmp/libomptarget/src/CMakeLists.txt +++ b/openmp/libomptarget/src/CMakeLists.txt @@ -30,6 +30,7 @@ # Build libomptarget library with libdl dependency. add_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES}) +set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN") if (OPENMP_ENABLE_LIBOMPTARGET_PROFILING) # Add LLVMSupport dependency if profiling is enabled. # Linking with LLVM component libraries also requires diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -85,11 +85,10 @@ config.test_flags += " -Wl,-rpath," + config.library_dir config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory else: # Unices - append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":") - append_dynamic_library_path('LD_LIBRARY_PATH', \ - config.omp_host_rtl_directory, ":") + config.test_flags += " -Wl,-rpath," + config.library_dir + config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory if config.cuda_libdir: - append_dynamic_library_path('LD_LIBRARY_PATH', config.cuda_libdir, ":") + config.test_flags += " -Wl,-rpath," + config.cuda_libdir append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":") append_dynamic_library_path('LIBRARY_PATH', \ config.omp_host_rtl_directory, ":")