Cmake error at CMakelists.txt

Hello
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?

Cheers,
Enrico

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 thisroot.sh to get ROOT in your PATH. Try to do source thisroot.sh 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/thisroot.sh 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 thisroot.sh, typically you’d just run source ~/Desktop/root/bin/thisroot.sh. 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.

Cheers,
Enrico

I typed
cmake …/root
And then
make
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