Skip to content

Commit 4893a8f

Browse files
authored
Merge pull request #535 from kavika13/master
Add RPATH to dynamic library build on OSX fixes #534 But we will revert if there are any complaints.
2 parents f6d785f + 8d54e33 commit 4893a8f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ IF(NOT WIN32)
2222
ENDIF()
2323
ENDIF()
2424

25+
# Enable runtime search path support for dynamic libraries on OSX
26+
IF(APPLE)
27+
SET(CMAKE_MACOSX_RPATH 1)
28+
ENDIF()
29+
2530
SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
2631
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
2732

src/lib_json/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ IF(BUILD_SHARED_LIBS)
4646
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
4747
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
4848

49+
# Set library's runtime search path on OSX
50+
IF(APPLE)
51+
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
52+
ENDIF()
53+
4954
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
5055
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
5156
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}

0 commit comments

Comments
 (0)