Skip to content

Commit 7ccf1e0

Browse files
committed
[roottest] Fix roottest trying to invoke /usr/bin/root.exe in tests.
When ROOT is installed in the system, roottest would try invoking /usr/bin/root.exe, leading to failures when trying to combine .pcms from two different ROOT builds. This was caused by a find_package(ROOT) and find_program(root-config), which find the system ROOT before the ROOT being configured. With roottest being part of the ROOT build, any find_package(ROOT) and discovery of root-config and ROOTSYS could be removed, since these variables are anyway known already in the running CMake configuration.
1 parent 2b9981a commit 7ccf1e0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

roottest/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
find_package(ROOT REQUIRED CONFIG)
2-
31
if(MSVC)
42
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY TRUE)
53
set(CMAKE_SUPPRESS_REGENERATION TRUE)
@@ -53,12 +51,13 @@ else()
5351

5452
# root-config --prefix helps to retrieve ROOTSYS env variable.
5553
# ROOT_BINDIR is set by ROOTConfig.cmake
56-
find_program(ROOT_CONFIG_EXECUTABLE root-config PATHS ${ROOT_BINDIR})
57-
if(NOT ROOT_CONFIG_EXECUTABLE)
58-
message(ERROR "root-config is not found, please rerun configuration step.")
54+
set(ROOT_CONFIG_EXECUTABLE ${ROOT_BINDIR}/root-config)
55+
if(NOT IS_EXECUTABLE ${ROOT_CONFIG_EXECUTABLE})
56+
message(ERROR "root-config was not found in ${ROOT_CONFIG_EXECUTABLE}.")
57+
endif()
58+
if(NOT IS_DIRECTORY ${ROOTSYS})
59+
message(FATAL_ERROR "ROOTSYS should be set before configuring roottest.")
5960
endif()
60-
execute_process(COMMAND ${ROOT_CONFIG_EXECUTABLE} "--prefix" OUTPUT_VARIABLE ROOTSYS RESULT_VARIABLE RETVAR OUTPUT_STRIP_TRAILING_WHITESPACE)
61-
set(ROOTSYS ${ROOTSYS} CACHE INTERNAL "")
6261
execute_process(COMMAND ${ROOT_CONFIG_EXECUTABLE} "--tutdir" OUTPUT_VARIABLE ROOT_TUTORIALS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
6362
set(ROOT_LIBRARIES Core RIO Net Hist Gpad Tree Rint Matrix MathCore)
6463
set(ROOT_root_CMD ${ROOTSYS}/bin/root.exe)
@@ -116,7 +115,7 @@ endif()
116115
set(CMAKE_ROOTTEST_DICT ON)
117116

118117
# Set the CMake module path. Here are all the custom CMake modules.
119-
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ROOT_SOURCE_DIR}/roottest/cmake/modules")
118+
list(APPEND CMAKE_MODULE_PATH "${ROOT_SOURCE_DIR}/roottest/cmake/modules")
120119

121120
#---Set flag for PyROOT tests that are expected to fail
122121
if(ROOT_pyroot_FOUND)

0 commit comments

Comments
 (0)