CMake Error at CMakeLists.txt:13 (find_package): By not providing "FindGeant4.cmake" in CMAKE_MODULE_PATH

5,611

Solution 1

I was having a similar problem.

It may help to add these commands in .bashrc:

source /home/user/geant4-install directory/bin/geant4.sh

source /home/user/geant4-install directory/share/geant4-version number/geant4make/geant4make.sh

export G4WORKDIR=/home/user/g4work

Solution 2

You just have to source the geant4.sh

In the bash shell, give the command:

source /path_to_geant4_install/bin/geant4.sh

And then do cmake

Share:
5,611

Related videos on Youtube

HF FH
Author by

HF FH

Updated on September 18, 2022

Comments

  • HF FH
    HF FH over 1 year

    I have a problem trying to install Geant4 on Linux system.

    $ cmake ..
    CMake Error at CMakeLists.txt:13 (find_package):
      By not providing "FindGeant4.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Geant4", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "Geant4" with any
      of the following names:
    
        Geant4Config.cmake
        geant4-config.cmake
    
      Add the installation prefix of "Geant4" to CMAKE_PREFIX_PATH or set
      "Geant4_DIR" to a directory containing one of the above files.  If "Geant4"
      provides a separate development package or SDK, be sure it has been
      installed.
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/dell/Desktop/geant4/geant4.9.6/examples/basic/B1/build/CMakeFiles/CMakeOutput.log".
    

    I tried:

    apt-get install g++
    

    But I get:

    E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
    
  • Pushan Gore
    Pushan Gore almost 7 years
    @Zanna Yes I have used it and it worked. If it doesn't work on your system, do let me know.
  • Waqas Rana
    Waqas Rana about 6 years
    when i tried your command , i am getting no such file or directory.
  • Waqas Rana
    Waqas Rana about 6 years
    I have checked there is no installation dir in my geant4 source dir .
  • Pushan Gore
    Pushan Gore about 6 years
    @WaqasRana Do the following Run this command in your terminal: locate geant4.sh And when you get the path, copy paste it in your source command where you want to cmake it.