Commit b1558793 authored by Giulio Eulisse's avatar Giulio Eulisse
Browse files

Properly handle rpath on macOS

Without this, the install_name of JAlienROOT is libJAlienROOT rather than
@rpath/libJAlienROOT, with the result things might break when SIP is
enabled.
parent 5d0aa817
Pipeline #2387539 passed with stage
in 9 minutes and 52 seconds
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(JAliEn-ROOT CXX)
cmake_policy(SET CMP0068 NEW)
list(APPEND CMAKE_PREFIX_PATH ${ROOTSYS})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(JSONC REQUIRED)
......@@ -9,6 +12,29 @@ find_package(ROOT REQUIRED COMPONENTS Net NetxNG Tree XMLIO)
find_package(ZLIB REQUIRED)
find_package(XROOTD REQUIRED)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(basePoint @loader_path)
else()
set(basePoint $ORIGIN)
endif()
# use, i.e. do not skip, the full RPATH in the _build_ tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, do not use the install RPATH already (will only be used when
# actually installing), unless we are on a Mac (where the install is otherwise
# pretty slow)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if(APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
# add to the install RPATH the (automatically determined) parts of the RPATH
# that point to directories outside the build tree
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH ${basePoint} ${basePoint}/../lib)
foreach(FEATURE xrootd xml)
if(NOT ROOT_${FEATURE}_FOUND)
message(FATAL_ERROR "ROOT was built without ${FEATURE} support (required)")
......@@ -70,6 +96,7 @@ set(HDRS
TAliceJobStatus.h
)
ROOT_GENERATE_DICTIONARY(G__${LIBNAME} "${HDRS}" LINKDEF LinkDef.h OPTIONS -Iinc)
add_library(${LIBNAME} SHARED "${SRCS}" G__${LIBNAME}.cxx)
target_link_libraries(${LIBNAME} ${ROOT_LIBRARIES} json-c websockets ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${XROOTD_LIBRARIES})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment