Skip to content

Commit

Permalink
build: Export FairRoot_CMAKE_MODULES_DIR
Browse files Browse the repository at this point in the history
Co-authored-by: @ChristianTackeGSI
  • Loading branch information
dennisklein committed Jun 14, 2024
1 parent 538e3f5 commit 60baa2d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
16 changes: 9 additions & 7 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
################################################################################
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
################################################################################
# Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################

install(DIRECTORY
modules
scripts
DESTINATION ${PROJECT_INSTALL_DATADIR}/cmake
)
set(PROJECT_CMAKE_MODULES_DIR ${PROJECT_INSTALL_DATADIR}/cmake/modules PARENT_SCOPE)
30 changes: 18 additions & 12 deletions cmake/modules/FindFairRoot.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
################################################################################
# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
# Find FairRoot installation
################################################################################
# Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
# Find FairRoot installation
# Check the environment variable "FAIRROOTPATH"

include(FindPackageHandleStandardArgs)
Expand Down Expand Up @@ -49,10 +49,16 @@ FIND_PATH(FAIRROOT_LIBRARY_DIR NAMES libBase.so libBase.dylib PATHS
${FAIRROOTPATH}/lib64
)

FIND_PATH(FAIRROOT_CMAKEMOD_DIR
NAMES modules/FindFairRoot.cmake modules/ROOTMacros.cmake
PATHS ${FAIRROOTPATH}/share/fairbase/cmake
)
if(FairRoot_CMAKE_MODULES_DIR)
set(FAIRROOT_CMAKEMOD_DIR "${FairRoot_CMAKE_MODULES_DIR}"
CACHE PATH "FairRoot CMake Modules Directory"
)
else()
FIND_PATH(FAIRROOT_CMAKEMOD_DIR
NAMES modules/FindFairRoot.cmake modules/ROOTMacros.cmake
PATHS ${FAIRROOTPATH}/share/fairbase/cmake
)
endif()

find_package_handle_standard_args(FairRoot CONFIG_MODE
REQUIRED_VARS FAIRROOT_INCLUDE_DIR
Expand Down
3 changes: 2 additions & 1 deletion cmake/private/FairRootConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (C) 2021-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# Copyright (C) 2021-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
Expand All @@ -10,6 +10,7 @@

set_and_check(@PROJECT_NAME@_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(@PROJECT_NAME@_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
set(@PROJECT_NAME@_CMAKE_MODULES_DIR "@PACKAGE_PROJECT_CMAKE_MODULES_DIR@")
set(@PROJECT_NAME@_GIT_VERSION "@PROJECT_GIT_VERSION@")
set(@PROJECT_NAME@_CXX_STANDARD "@CMAKE_CXX_STANDARD@")

Expand Down
5 changes: 3 additions & 2 deletions cmake/private/FairRootPackage.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (C) 2021-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# Copyright (C) 2021-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
Expand Down Expand Up @@ -32,7 +32,8 @@ function(install_cmake_package)
PATH_VARS
CMAKE_INSTALL_PREFIX
CMAKE_INSTALL_FULL_BINDIR
PACKAGE_INSTALL_DESTINATION)
PACKAGE_INSTALL_DESTINATION
PROJECT_CMAKE_MODULES_DIR)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
Expand Down

0 comments on commit 60baa2d

Please sign in to comment.