Incorrect path of ROOT_LIBRARIES in cmake

Hi expert,

I was compiling a geant4 + root project using cmake on a WSL system (Ubuntu 18).
The “ROOT_INCLUDE_DIRS” gives correct path, i.e. …/Desktop/root/include.
However, the “ROOT_LIBRARIES” gives …/Desktop/root2/lib/…

I believe the problem is that I had multiple installation of different ROOT versions before and one of the installation is done in a folder called root2. However, the libraries path is still in root2 even though I have already removed all folders and reinstall ROOT. Is there anyway to correct the path?

I installed ROOT using cmake to build from source before. The new installation is done by simply unpacking the binary files. Thank you very much!


Could you expand a bit which commands you executed, and how they failed (e.g. error messages)? Reading the question, I’m also not quite sure if you are currently trying to get a binary release of ROOT running or if you are still trying to compile ROOT from sources.



Sorry for the confusion. I had a root+ geant4 project linked by using cmake. I failed to compile it because in cmake the variable ${ROOT_LIBARAIES} returns a path corresponding to an old version of ROOT installed in my computer (although it is deleted).

I tried reinstalling ROOT and run the command “cmake …/src/” in the build folder but ${ROOT_LIBARAIES} still use the old path. The problem is that I ranthis command in the existing build. So I simply create a new folder and the “ROOT_LIBARAIES” gives the correct path in cmake. Thank you for your time.

That looks like an issue with your Geant4 build config not being updated, right? What is ROOT_LIBRARIES - is that a Geant4 variable? Does that point to the location of the ROOT libraries?

If so you might be able to run, in your Geant4 build directory, cmake -ROOT_LIBRARIES=$ROOTSYS/lib . i.e. just updating that variable to its new value, followedd by make -j8 or whatever you use to build Geant4.