CMake macOS Xcode Environment

When macOS or Xcode upgrades, CMake build directories often need to be refreshed. If the user has set custom environment variables concerning Xcode, they may need to be updated as well. Here are some important variables to check if problems occur after upgrading macOS or Xcode.

For a simple CMake project on macOS, CMakeCache.txt might include:

CMAKE_OSX_DEPLOYMENT_TARGET:STRING=

CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk

Having multiple directories under /Library/Developer/CommandLineTools/SDKs and /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs is fine, CMake can select the appropriate one. The user can select the SDK:

xcode-select --switch

but often this is not necessary.