Skip to content

Commit ce505e1

Browse files
YanzhaoWjose-luis-rs
authored andcommitted
fix cmake failure to find faircmakemodules
1 parent d67a4f3 commit ce505e1

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

CMakeLists.txt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ if(NOT DEFINED ENV{SIMPATH})
4747
endif(NOT DEFINED ENV{SIMPATH})
4848
set(SIMPATH $ENV{SIMPATH})
4949

50+
if(SIMPATH)
51+
set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
52+
endif()
53+
5054
if(NOT DEFINED ENV{FAIRROOTPATH})
5155
message(
5256
FATAL_ERROR
@@ -75,20 +79,15 @@ option(WITH_FRS "Build FRS" OFF)
7579
option(WITH_ASYEOS "Build ASYEOS" OFF)
7680
option(BUILD_C3W "Build C3W" OFF)
7781

78-
find_package(FairCMakeModules 1.0.0 QUIET)
79-
if(FairCMakeModules_FOUND)
80-
include(FairFindPackage2)
81-
include(FairFormattedOutput)
82-
else()
83-
message(STATUS "Could not find FairCMakeModules. "
84-
"It is recommended to install https://github.com/FairRootGroup/FairCMakeModules")
82+
find_package(FairCMakeModules 1.0.0 CONFIG REQUIRED)
83+
if(NOT FairCMakeModules_FOUND)
84+
message(FATAL_ERROR "Could not find FairCMakeModules! ")
8585
endif()
8686

87-
if(COMMAND find_package2)
88-
find_package2(PUBLIC FairRoot VERSION 18.6.4 QUIET)
89-
else()
90-
find_package(FairRoot)
91-
endif()
87+
include(FairFindPackage2)
88+
include(FairFormattedOutput)
89+
90+
find_package2(PUBLIC FairRoot REQUIRED)
9291

9392
# FairRoot_VERSION is eventually set by find_package, for now let's set it explicitly
9493
execute_process(
@@ -108,10 +107,6 @@ endif()
108107
# added a variable to point to r3broot path in the system
109108
set(R3BROOTPATH ${CMAKE_INSTALL_PREFIX})
110109

111-
if(SIMPATH)
112-
set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
113-
endif()
114-
115110
# Load some basic macros which are needed later on
116111
include(FairMacros)
117112

0 commit comments

Comments
 (0)