Geant4 installation help

I am trying to build Geant4 (v10.06.p02)
when I do
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/GEANT4/geant4.10.06.p02-install /path/to/source/GEANT4/geant4.10.06.p02
the code gets configured without any errors but if I include any of the flags, I start getting errors
cmake -DGEANT4_USE_GDML=ON -DCMAKE_INSTALL_PREFIX=/home/rushabh/software/GEANT4/geant4.10.06.p02-install /home/rushabh/software/GEANT4/geant4.10.06.p02
gives me an error
`

`-- The C compiler identification is GNU 9.3.0
– The CXX compiler identification is GNU 9.3.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version “2.2.9”)
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Failed to find XercesC missing: XercesC_LIBRARY XercesC_INCLUDE_DIR
XercesC_VERSION)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindXercesC.cmake:99 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/Modules/Geant4OptionalComponents.cmake:168 (find_package)
cmake/Modules/G4CMakeMain.cmake:59 (include)
CMakeLists.txt:50 (include)

– Configuring incomplete, errors occurred!
See also “/home/rushabh/software/GEANT4/geant4.10.06.p02-build/CMakeFiles/CMakeOutput.log”. `

I am not sure why it gives off error saying missing: XercesC_LIBRARY XercesC_INCLUDE_DIR
XercesC_VERSION
since I have xercesc installed. I went through CMakeLists.txt but could not understand the problem.

Can anyone point me in the right direction. Or I am missing some env variables?

You help cmake locate XercesC installation directory by adding -DCMAKE_PREFIX_PATH=/path/to/XercesC> to your cmake command:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/GEANT4/geant4.10.06.p02-install /path/to/source/GEANT4/geant4.10.06.p02 -DCMAKE_PREFIX_PATH=/path/to/XercesC>

If that doesn’t work, you can also set directly configuration options like XERCESC_ROOT_DIR or XercesC_LIBRARY and XercesC_INCLUDE_DIR, have a look for explanation in the user guide.

Did you make sure to install the development package, as well as the ‘normal’ one?

On debian/ubuntu systems, it’s the one ending -dev and is required by geant4.

installing the dev packages managed to fix this!
Thank you