CMAKE_OSX_DEPLOYMENT_TARGET not setting min version? (Xcode, clang)

Hi all,
I have a GUI macOS app that gets built with CMake and the Xcode generator. The version and architectures are set up like this:

set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
set(CMAKE_OSX_ARCHITECTURES arm64 x86_64)

Even with the target set to 10.13, builds from my machine (Intel Mac running Ventura 13.4) give an error on pre 13.3 systems that macOS 13.3 or newer is required. I read through CMake’s output, clang is being called with -target arm64-apple-macos10.13 so I guess it’s not a compiler flag issue. Might it be an issue with the Xcode generator or an incorrect version of the mac SDK or something?
Any insight or advice much appreciated!

I don’t recall which ones, but some of the Apple-specific variables have to be set as cache variables, not just regular variables (at least, with some versions of CMake this has been the case, I think it still is). Try defining them as cache variables from the cmake command line or a toolchain file and see if that makes any difference to the project you’re testing this with.

1 Like