Handling CMAKE_OSX_ARCHITECTURES being set to $(ARCHS_STANDARD) in generate_apple_architecture_selection_file()
The implementation and documentation for generate_apple_architecture_selection_file()
both assume CMAKE_OSX_ARCHITECTURES
lists specific architectures, but a common practice when using the Xcode generator is to give it the special value $(ARCHS_STANDARD)
. This lets Xcode handle the set of architectures to build for, which is handy when performing an archive operation with xcodebuild. On the surface, it would seem that generate_apple_architecture_selection_file()
doesn't handle a value like $(ARCHS_STANDARD)
, and the comments in #25516 (closed) seem to dismiss supporting such a value. But I'm wondering if it would work if $(ARCHS_STANDARD)
was listed as one of the single architectures? This feels like an abuse of knowledge of the implementation details, but maybe this suggests a way we could formally support $(ARCHS_STANDARD)
as a special case when using the Xcode generator. I'd expect the include file for such a special value would probably map to the same one as UNIVERSAL_INCLUDE_FILE
, but that's just a guess on my part, so we shouldn't assume that.
The documentation also makes no mention of cases where CMAKE_OSX_ARCHITECTURES
might hold a special value like $(ARCHS_STANDARD)
. While we don't currently mention $(ARCHS_STANDARD)
anywhere else in the docs, I think that in this case, it is going to be relevant and common enough that we probably should explicitly document it and how to handle it. $(ARCHS_STANDARD)
is essentially what Xcode uses by default when you create a new project in the Xcode IDE outside of CMake. With the recently added XCFramework support in CMake, plus the functionality added to CMakePackageHelpers in CMake 3.29, CMake projects might finally be able to start using find_package()
and have it actually work for multi-architecture builds with the Xcode generator.
If we choose not to support $(ARCHS_STANDARD)
in generate_apple_architecture_selection_file()
, the documentation should be updated to explicitly mention that.