May 6, 2013

How to embed root code inside Geant4 using CMakeFile.txt

To use root modules inside Geant4 framework, we must have (1) already compiled root library with header files somewhere like /usr/local/root. (2) Then we must define some compile option in CMakeFile.txt which is located in our geant4 project directory (such like /path_to/examples/N03). If we use make, definition should be in GMakefile(or Makefile) instead of CMakeFile.txt. That's all.

I assume that we already have well compiled recent release of root and geant4 and we already know how to use both of code. if you need to know installing and using method of both code, please visit geant4 and root homepage.

To use following configuration, ROOTSYS environment variable must be set already.
     export ROOTSYS=/path/to/root





If you use recent cmake distribution, you might have following error.



Then simply open your FindROOT.cmake file at /path/to/root/etc/FindROOT.cmake. And replace
   include(CMakeMacroParseArguments)
   to
   include(CMakeParseArguments)
CMakeMacroParseArguments is deprecated method in recent cmake utility.