From 2c6c97edc1030716af5cca3a1c5f25174fc67044 Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Fri, 10 May 2024 17:56:42 -0300 Subject: [PATCH] do not set INSTALL_NAME_DIR for MacOS builds for CMake >= 3.0 --- Utilities/gdcmopenjpeg/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Utilities/gdcmopenjpeg/CMakeLists.txt b/Utilities/gdcmopenjpeg/CMakeLists.txt index 565cc338b4..878d27e22a 100644 --- a/Utilities/gdcmopenjpeg/CMakeLists.txt +++ b/Utilities/gdcmopenjpeg/CMakeLists.txt @@ -166,8 +166,14 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR) endif() if (APPLE) - list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") - option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) + if (${CMAKE_VERSION} VERSION_LESS 3.0) + # For cmake >= 3.0, we turn on CMP0042 and + # https://cmake.org/cmake/help/v3.0/policy/CMP0042.html mentions + # "Projects wanting @rpath in a target’s install name may remove any + # setting of the INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables" + list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") + endif() + option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) endif() #-----------------------------------------------------------------------------