If you don’t specify CMAKE_OSX_SYSROOT, then CMake seems to default to some invalid SDK, or uses the DEPLOYMENT_TARGET which is far too low for the SDK. SYSROOT is effectively, the maximum build of macOS that the app supports. Anything higher should be fine.
So then I specify the build number (see below), and that works on my machine. One another machine, the newer Xcode breaks. I don’t want devs to have to chase changing this, and CMake really really breaks when it can’t find the SDK and declares invalid C and CXX and OBJ_CXX compilers instead of just stating that it couldn’t find the SDK.
What is the cmake specification for use whatever is the available SDK in Xcode? Also setting ARCHS_STANDARD doesnt work. I’m on CMake 3.19.1 on macOS Intel and ARM.
Snippet from CMakeLists.txt
# Xcode 12.2 ships with macosx11.0, but 12.3 ships with macosx11.1 # Xcode 12.3 completely breaks when this is set and can't find c compilers. set(CMAKE_OSX_SYSROOT macosx11.0) # this only works, finds macosx11.0.sdk in Xcode 12.2 # set(CMAKE_OSX_SYSROOT macos) # this doesn't work, despite there being a macos.sdk set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14) # this works, great! set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)") <- this doesn't work either