I’m trying to build a Geant4 application that uses some ROOT classes. It works for ROOT5 but it’s about time I added support for ROOT6.
However, I’m running into a strange issue where the CMakeLists.txt
of the Geant code cannot find the ROOT headers:
fatal error: 'TGraph.h' file not found
#include "TGraph.h"
I have edited CMakeLists.txt
a bit to print more info:
# Add ROOT?
#
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
find_package(ROOT REQUIRED COMPONENTS RIO)
if (ROOT_FOUND)
message("ROOT found: ${ROOT_INCLUDE_DIR}")
else()
message (FATAL_ERROR "ROOT not found")
endif()
include_directories(${ROOT_INCLUDE_DIR})
which produces
(base) jvavrek:~/project$ cmake .
ROOT found:
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jvavrek/project
So it looks like cmake
is finding the ROOT installation but not the includes in ROOT_INCLUDE_DIR, which is an empty string. If I manually replace ROOT_INCLUDE_DIR with /Users/jvavrek/root/install/include
everything compiles. If I put that path on $PATH, but let cmake
try to find the libraries, the build fails again.
ROOT Version: ROOT 6.18/00
Platform: Mac OS X 10.14.6
Compiler: cmake version 3.15.4