CMake 3.30 doesn't let me use $(ARCHS_STANDARD) to set CMAKE_OSX_ARCHITECTURES

Cmake 3.30 seems to have broken my projects that build universal binaries (arm64;x86_64)

I use this to create universal binaries when building via Xcode:


Until Cmake 3.29.6 this still worked fine. I’m using Xcode 15.1.
Now it seems the $(ARCHS_STANDARD) (which is resolved by Xcode) can no longer be used because of some “consistency check” that probably happens before this variable is resolved.

This is the commit that causes a FATAL_ERROR

  The C compiler targets architectures:




Is this a newly-introduced Cmake bug? Or is my way of using $(ARCHS_STANDARD) not proper or supported anymore?

If I set it explicitly to set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING ""), everything works as expected.

do you want to use an environment value?

1 Like

ARCHS_STANDARD is not defined as an environment variable (?)

Or did you mean manually defining an env variable ARCHS_STANDARD and assigning it " "x86_64;arm64"?

I thought about running xcodebuild -showBuildSettings | grep ARCHS_STANDARD from within Cmake, but this requires an existing Xcode project.

It seems to me that Xcode expect an environment var?
see TN3117: Resolving architecture build errors on Apple silicon | Apple Developer Documentation

I’m not following you…

$(ARCHS_STANDARD) is a variable defined by Xcode, not an enviroment variable.

with this set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD) CACHE STRING "") I’m assigning the literal string $(ARCHS_STANDARD) to CMAKE_OSX_ARCHITECTURES. Xcode will later resolve $(ARCHS_STANDARD) to e.g. “arm64 x86_64”

That is not the problem – CMakeCache.txt shows the correct entry:

The problem is that, since Cmake 3.30, Cmake will abort because of some ‘consistency check’ because it cannot resolve $(ARCHS_STANDARD) (which is obvious).

This is the ‘breaking change’: APPLE: Check if compilers respect CMAKE_OSX_ARCHITECTURES · Kitware/CMake@db409e5 · GitHub

If you are suggesting “pre-resolving” $(ARCHS_STANDARD) e.g. with xcodebuild -showBuildSettings | grep ARCHS_STANDARD and saving it an environment variable and then using that within Cmake – yes, that would work, I guess.
But I don’t get why this should be necessary - the “literal string” method has worked with Cmake for years (decades).

This sounds like a regression. Could you please file a bug report in the issue tracker here:

1 Like

Thanks for confirming, Craig Scott

I’ve created an issue: