Browse Source

Merge topic 'xcode-compiler-id-arch' into release-3.19

98849039cc Xcode: Default to arm64 arch on Apple Silicon hosts during compiler id

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5505
Brad King 5 years ago
parent
commit
18f152e9c0
2 changed files with 9 additions and 2 deletions
  1. 8 1
      Modules/CMakeDetermineCompilerId.cmake
  2. 1 1
      Modules/CompilerId/Xcode-3.pbxproj.in

+ 8 - 1
Modules/CMakeDetermineCompilerId.cmake

@@ -516,9 +516,16 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
     endif()
     if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]")
       # When targeting macOS, use only the host architecture.
-      set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
+      if (_CMAKE_APPLE_ARCHS_DEFAULT)
+        set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";")
+        set(id_arch_active "ONLY_ACTIVE_ARCH = NO;")
+      else()
+        set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
+        set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
+      endif()
     else()
       set(id_archs "")
+      set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
     endif()
     configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
       ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)

+ 1 - 1
Modules/CompilerId/Xcode-3.pbxproj.in

@@ -80,11 +80,11 @@
 		1DEB928A08733DD80010E9CD = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ONLY_ACTIVE_ARCH = YES;
 				CODE_SIGNING_REQUIRED = NO;
 				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
 				SYMROOT = .;
 				@id_archs@
+				@id_arch_active@
 				@id_toolset@
 				@id_lang_version@
 				@id_clang_cxx_library@