Skip to content

Commit f175cf6

Browse files
committed
[Core] Set a BUILD_RPATH for libCore.
Usually, CMake automatically sets RUNPATH when target_link_libraries is used. However, since Core doesn't have other ROOT dependencies, its RUNPATH might only contain external dependencies or remain empty. To enable Core to find other ROOT libraries, its current location is added to its BUILD_RPATH.
1 parent 4c3335e commit f175cf6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ add_custom_target(rconfigure ALL DEPENDS ${CMAKE_BINARY_DIR}/include/RConfigure.
2626

2727
ROOT_LINKER_LIBRARY(Core BUILTINS LZMA)
2828

29+
# This sets RUNPATH for libCore, which enables it to dlopen any ROOT library in its directory.
30+
# If omitted, Core might try to load libraries from a ROOT that's installed in the system.
31+
if(APPLE)
32+
set_property(TARGET Core APPEND PROPERTY BUILD_RPATH @loader_path)
33+
elseif(NOT WIN32)
34+
set_property(TARGET Core APPEND PROPERTY BUILD_RPATH $ORIGIN)
35+
endif()
36+
2937
generateHeader(Core
3038
${CMAKE_SOURCE_DIR}/core/base/src/root-argparse.py
3139
${CMAKE_BINARY_DIR}/ginclude/TApplicationCommandLineOptionsHelp.h

0 commit comments

Comments
 (0)