Not able to integrate ROOT 6.18 using Cmake in GEANT4

[quote=“pratyush06853, post:1, topic:1252, full:true”]
My CmakeLists has

find_package(ROOT 6.18 CONFIG REQUIRED)

include({Geant4_USE_FILE}) include_directories({PROJECT_SOURCE_DIR}/include)

include_directories(${ROOT_DIR})

message("${ROOT_DIR}")

But i keep getting error message

#include “TFile.h”
^~~~~~~~~
1 error generated.

Any help/comments is appreciated. Thanks

Hello,

You should change
include_directories(${ROOT_DIR})
with
include_directories(${ROOT_INCLUDE_DIRS})

For a complete example of CMakeLists.txt for a Geant4 code with usage of ROOT you can take a look in examples/extended/analysis/AnaEx02.

Best regards,

Thanks a lot, it worked.