From 33928a4d5b5df43fb62fb0ce4aa69568545c9eeb Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 11 Jan 2017 16:13:47 +0100 Subject: [PATCH] I hope I understood how to use RPATH on Mac OSX --- tools/cmake/Java.cmake | 5 +++++ tools/cmake/MakeLib.cmake | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/cmake/Java.cmake b/tools/cmake/Java.cmake index eb20402562..55bf8b83bf 100644 --- a/tools/cmake/Java.cmake +++ b/tools/cmake/Java.cmake @@ -37,6 +37,11 @@ endif() add_library(simgrid-java SHARED ${JMSG_C_SRC}) set_target_properties(simgrid-java PROPERTIES VERSION ${libsimgrid-java_version}) set_target_properties(simgrid-java PROPERTIES SKIP_BUILD_RPATH ON) +if(APPLE) + # add the current location of libsimgrid-java.dynlib as a location for libsimgrid.dynlib + # (useful when unpacking the native libraries from the jarfile) + set_target_properties(simgrid-java PROPERTIES CMAKE_INSTALL_RPATH "@loader_path/.") +endif() target_link_libraries(simgrid-java simgrid) diff --git a/tools/cmake/MakeLib.cmake b/tools/cmake/MakeLib.cmake index 7210bc7d98..f67255192a 100644 --- a/tools/cmake/MakeLib.cmake +++ b/tools/cmake/MakeLib.cmake @@ -1,8 +1,8 @@ ### Make Libs -# On Mac OSX, don't specify where to look for the dependencies -# Otherwise, the libsimgrid-java will not find libsimgrid, as it is located in a temporary directory -set(MACOSX_RPATH OFF) +# On Mac OSX, specify that rpath is useful to look for the dependencies +# See https://cmake.org/Wiki/CMake_RPATH_handling and Java.cmake +set(MACOSX_RPATH ON) ############################### # Declare the library content # -- 2.20.1