Cmake Mac SDK error

Hi,

I updated my Mac to Monterey 12.1 recently.

This resulted in the SDKs being updated in the folder /Library/Developer/CommandLineTools/SDKs/.

When VScode opens a folder containing a project e.g. B1 example, the Mac sets up with ‘Clang 12.0.5 x86.64. apple_darwin20.6.0’ (there may be a . or _ incorrect as typed manually)
the cmake process then automatically gets triggered which causes the following message to appear:

[cmake] CMake Error in CMakeLists.txt:
[cmake]   Imported target "Geant4::G4Tree" includes non-existent path
[cmake] 
[cmake]     "/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include"
[cmake] 
[cmake]   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
[cmake] 
[cmake]   * The path was deleted, renamed, or moved to another location.
[cmake] 
[cmake]   * An install or uninstall procedure did not complete successfully.
[cmake] 
[cmake]   * The installation package was faulty and references files it does not
[cmake]   provide.
[cmake] 
[cmake] 
[cmake] 
[cmake] CMake Error in CMakeLists.txt:
[cmake]   Imported target "Geant4::G4Tree" includes non-existent path
[cmake] 
[cmake]     "/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include"
[cmake] 
[cmake]   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
[cmake] 
[cmake]   * The path was deleted, renamed, or moved to another location.
[cmake] 
[cmake]   * An install or uninstall procedure did not complete successfully.
[cmake] 
[cmake]   * The installation package was faulty and references files it does not
[cmake]   provide.

The way I have resolved this is to go into the build folder, go to CMakeCache.txt and change all the 12.0 or 12.1 .sdk references (which refer to the actual folders) to 12.sdk which is the alias in the aforementioned SDK folder. I then in the build folder type:

cmake -S .. -B . 
make

And all is well and it works as intended. Any better fix would be greatly appreciated :slight_smile:

This is resolved by modifying the variables:

OPENGL_gl_LIBRARY
OPENGL_INCLUDE_DIR
EXPAT_INCLUDE_DIR

in the cmake documents:

/usr/local/lib/Geant4-10.7.2/Geant4PackageCache.cmake
/usr/local/lib/Geant4-10.7.2/Geant4Config.cmake

to the alias filepath for the .sdk

Hi Edward

Thanks for this fix for Geant4 10.7. 10.7 was never tested on MacOS 12, so a failure is possible. Geant4 11.0 is supported on MacOS 12, as the Release Notes say:

macOS 12.01 Monterey with Apple LLVM/Clang-13.
Tested on 64 bit architectures (Intel or Apple Silicon).

Thanks again
John

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