Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I hope I understood how to use RPATH on Mac OSX
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 11 Jan 2017 15:13:47 +0000 (16:13 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 11 Jan 2017 15:13:47 +0000 (16:13 +0100)
tools/cmake/Java.cmake
tools/cmake/MakeLib.cmake

index eb20402..55bf8b8 100644 (file)
@@ -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)
 
index 7210bc7..f672551 100644 (file)
@@ -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 #