CMake Error at cmake/Modules/G4CMakeMain.cmake:39(message):

Hi, I’m trying to install geant4.11.0.2 on my M1 Macbook Air. I used homebrew (I know it’s not recommended) and cmake GUI to configure it. I encountered the above-mentioned error. Furthermore, it says that G4CMakeMain can only be included once. I attached the error log here. Any help is much appreciated.
CMakeError.pdf (15.5 KB)

Could you please cut and paste the text from the GUI/terminal here please? This will be a lot clearer and more helpful than a PDF…

CMake Error at cmake/Modules/G4CMakeMain.cmake:39 (message):
G4CMakeMain can only be included once
Call Stack (most recent call first):
source/CMakeLists.txt:50 (include)

Where did you unpack the Geant4 sources, and what did you set the source and build directories to in CMake? Have you made any modifications to the sources?

The source and build are in the Downloads. Here is the path of the source /Users/“name”/Downloads/geant4-v11.0.2 The build subdirectory is within geant4-v11.0.2. I dragged the CMakeLists.txt to CMake 3.24.0-rc4 GUI to run the configuration. In terms of modification, I copied the CMakeLists.txt in the source folder of geant4-v11.0.2. Technically, there are two CMakeLists.txt files within geant4-v11.0.2.

The build directory as a subdirectory is fine, but I think the drag/drop/copy has completely messed things up. I would suggest deleting /Users/“name”/Downloads/geant4-v11.0.2 completely and re-unpack the source tarball.

It’s generally easiest to use the Terminal to do the configuration/build, and full instructions are in the Installation Guide. Otherwise, in the CMake GUI, make sure the source/build directories are separate, and use the interface to browse to and select the root directory of the unpacked sources. I would not recommend drag-and-dropping cmake files.

I’ll give it a go. Thanks for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.