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