Cmake error at CMakelists.txt

Can anyone help
I have CMake Errors at CMakelists.txt ( find package
I’m trying to figure out this problem but I don’t know how can I solve

Hi @Mohammad,
welcome to the ROOT forum!

It seems that you are trying to compile a cmake project that depends on ROOT, but you don’t have a (active) ROOT installation.

Do you have ROOT installed on your computer? Can you start the ROOT prompt with the root command?


Thank you for reply
I actually I installed root in my laptop and when I completed I put the command root but dose not give me massage

Ok, so you need to source to get ROOT in your PATH. Try to do source before starting the cmake build of your project.

As you can see here my project is ProtonMC
I want to compile it with root and Geant4

I typed root
It doesn’t work

source /path/to/your/root/installation/bin/ is the command that makes ROOT available in a terminal. You have to give that command before you do anything ROOT-related.

If you want to always have ROOT available, you can put that source command in your ~/.bashrc file (or whatever file is always read by your shell at startup).

Unfortunately I haven’t typed this command before
Because I don’t have background about it
So how can I solve this problem

It’s that command you typed before starting root – but instead of cd-ing into Desktop/root/bin and then running source, typically you’d just run source ~/Desktop/root/bin/ That is the command that makes ROOT available in a linux shell. If you run it before trying to compile your project, cmake should be able to find ROOT and that should solve the issue in your first post.

Can you please send to me the commands of Root install
Because I’m trying to download it again
Thank you

Scroll down to the bottom of this page and you will get the instructions to build ROOT from sources (in the “Building” section).

I’m followed the sptep of Root install, I started download it but when I want to (cmake - -build . - - -j8) , the downloading work until reached 73% and then suddenly stopped ( Virtual memory exhausted: Cannot allocate memory)
Can you help with this please

Can you try to recompile using “cmake - -build .” only, without “-j8”?

$ cmake ../root
$ make 

I tried cmake - -build
It give me this

Hi Mohammad,
the command to start a build is either cmake --build . (note the dot at the end) or make.

The “memory exhausted” error you got before is because you were building with 8 threads (-j8) and that requires more RAM that your virtual machine has been assigned.


I typed
cmake …/root
And then
So I’m still waiting to see

I have just finished (cmake …/root)and (make)
Can you help me please what is next commands should I put it

Scroll down to the bottom of this page