Skip to content

Commit

Permalink
fix: set RPATH after OUTPUT_DIRECTORY defined
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Sep 11, 2023
1 parent c29ee17 commit 5d6cf53
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ endif()
# Export compile commands as json for run-clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# When building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# Add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# This PROJECT_SOURCE_DIR at this point corresponds to repository root.
# Saving it as EICRECON_SOURCE_DIR so can be used for jana_plugin.cmake
# to correctly set plugin includes (and in other places as needed)
Expand Down Expand Up @@ -94,6 +82,22 @@ if(NOT DEFINED PLUGIN_LIBRARY_OUTPUT_DIRECTORY)
endif()
message(STATUS "${CMAKE_PROJECT_NAME}: PLUGIN_LIBRARY_OUTPUT_DIRECTORY: ${PLUGIN_LIBRARY_OUTPUT_DIRECTORY}")

# When building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${PLUGIN_LIBRARY_OUTPUT_DIRECTORY};${CMAKE_INSTALL_PREFIX}/${PLUGIN_OUTPUT_DIRECTORY}"
)

# Add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# This PROJECT_SOURCE_DIR at this point corresponds to repository root.
# Saving it as EICRECON_SOURCE_DIR so can be used for jana_plugin.cmake
# to correctly set plugin includes (and in other places as needed)
set(EICRECON_SOURCE_DIR ${PROJECT_SOURCE_DIR})


# Check and print what JANA2 is used
find_package(JANA 2.0.8 REQUIRED)
Expand Down

0 comments on commit 5d6cf53

Please sign in to comment.