From 69962fefc233ba06450b353073a2db4a9fce3ceb Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 13 Jan 2022 21:55:21 +1300 Subject: Specify CMAKE_INSTALL_RPATH for macOS; use -rpath LDFLAGS for tests (#3009) --- src/CMakeLists.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 311cdbac..752d69f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,17 +23,14 @@ option(BUILD_PROJSYNC if(NOT MSVC) - if(NOT APPLE) - # Use relative path so that package is relocatable - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${LIBDIR}") - else() + # Use relative path so that package is relocatable + if(APPLE) set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") - # TO DO: cmake 2.8.12 introduces a way to make the install tree - # relocatable with OSX via - # (1) set(CMAKE_MACOSX_RPATH ON) and - # (2) setting the INSTALL_RPATH property on the executables to - # "@loader_path/../${LIBDIR}" + set(CMAKE_INSTALL_RPATH "@loader_path/../${LIBDIR}") + else() + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${LIBDIR}") endif() + # Other apps can link to libproj using e.g. LDFLAGS -Wl,-rpath,${prefix}/lib else() -- cgit v1.2.3