![CMakeLists.txt:13(find_package)处的 CMake 错误:由于未在 CMAKE_MODULE_PATH 中提供“FindGeant4.cmake”](https://linux22.com/image/1146144/CMakeLists.txt%3A13%EF%BC%88find_package%EF%BC%89%E5%A4%84%E7%9A%84%20CMake%20%E9%94%99%E8%AF%AF%EF%BC%9A%E7%94%B1%E4%BA%8E%E6%9C%AA%E5%9C%A8%20CMAKE_MODULE_PATH%20%E4%B8%AD%E6%8F%90%E4%BE%9B%E2%80%9CFindGeant4.cmake%E2%80%9D.png)
我在 Linux 系统上安装 Geant4 时遇到问题。
$ 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".
我试过:
apt-get install g++
但我明白:
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?
答案1
你只需要找到geant4.sh
在 bash shell 中,输入命令:
source /path_to_geant4_install/bin/geant4.sh
然后做cmake
答案2
我遇到了类似的问题。
添加以下命令可能会有所帮助.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