Merge topic 'FindBLAS-eml'

a7f6e5dbf9 FindBLAS: use unset instead of set for empty variables
92edd7376b FindBLAS: Fix regression in finding EML_mt after recent refactoring

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6397
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1261eb0..fdfe456 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,6 +361,9 @@
   if(CMake_NO_CXX_STANDARD)
     set(KWSYS_CXX_STANDARD "")
   endif()
+  if(CMake_NO_SELF_BACKTRACE)
+    set(KWSYS_NO_EXECINFO 1)
+  endif()
   if(WIN32)
     # FIXME: Teach KWSys to hard-code these checks on Windows.
     set(KWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC_COMPILED 0)
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake
index 48371e6..00729bc 100644
--- a/Modules/FindXCTest.cmake
+++ b/Modules/FindXCTest.cmake
@@ -156,8 +156,9 @@
         XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)"
         XCODE_ATTRIBUTE_TEST_HOST "$<TARGET_FILE:${testee}>")
       if(XCODE_VERSION VERSION_GREATER_EQUAL 7.3)
-        # CMAKE_XCODE_BUILD_SYSTEM equals 12 means that at least Xcode 11.x is used.
+        # The Xcode "new build system" used a different path until Xcode 12.5.
         if(CMAKE_XCODE_BUILD_SYSTEM EQUAL 12 AND
+           XCODE_VERSION VERSION_LESS 12.5 AND
            NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
           set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>")
         else()
diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json
index b363718..64eeac4 100644
--- a/Templates/MSBuild/FlagTables/v142_CL.json
+++ b/Templates/MSBuild/FlagTables/v142_CL.json
@@ -664,27 +664,6 @@
     "flags": []
   },
   {
-    "name": "CompileAs",
-    "switch": "interface",
-    "comment": "Compile as C++ Module Code",
-    "value": "CompileAsCppModule",
-    "flags": []
-  },
-  {
-    "name": "CompileAs",
-    "switch": "internalPartition",
-    "comment": "Compile as C++ Module Internal Partition",
-    "value": "CompileAsCppModuleInternalPartition",
-    "flags": []
-  },
-  {
-    "name": "CompileAs",
-    "switch": "exportHeader",
-    "comment": "Compile as C++ Header Unit",
-    "value": "CompileAsHeaderUnit",
-    "flags": []
-  },
-  {
     "name": "ErrorReporting",
     "switch": "errorReport:none",
     "comment": "Do Not Send Report",
@@ -787,13 +766,6 @@
     ]
   },
   {
-    "name": "ForceSynchronousPDBWrites",
-    "switch": "FS",
-    "comment": "Force Synchronous PDB Writes",
-    "value": "true",
-    "flags": []
-  },
-  {
     "name": "IntrinsicFunctions",
     "switch": "Oi",
     "comment": "Enable Intrinsic Functions",
diff --git a/Templates/MSBuild/FlagTables/v143_CL.json b/Templates/MSBuild/FlagTables/v143_CL.json
index 9d8ddb0..8b700aa 100644
--- a/Templates/MSBuild/FlagTables/v143_CL.json
+++ b/Templates/MSBuild/FlagTables/v143_CL.json
@@ -659,27 +659,6 @@
     "flags": []
   },
   {
-    "name": "CompileAs",
-    "switch": "interface",
-    "comment": "Compile as C++ Module Code",
-    "value": "CompileAsCppModule",
-    "flags": []
-  },
-  {
-    "name": "CompileAs",
-    "switch": "internalPartition",
-    "comment": "Compile as C++ Module Internal Partition",
-    "value": "CompileAsCppModuleInternalPartition",
-    "flags": []
-  },
-  {
-    "name": "CompileAs",
-    "switch": "exportHeader",
-    "comment": "Compile as C++ Header Unit",
-    "value": "CompileAsHeaderUnit",
-    "flags": []
-  },
-  {
     "name": "ErrorReporting",
     "switch": "errorReport:none",
     "comment": "Do Not Send Report",
@@ -789,13 +768,6 @@
     ]
   },
   {
-    "name": "ForceSynchronousPDBWrites",
-    "switch": "FS",
-    "comment": "Force Synchronous PDB Writes",
-    "value": "true",
-    "flags": []
-  },
-  {
     "name": "IntrinsicFunctions",
     "switch": "Oi",
     "comment": "Enable Intrinsic Functions",
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt
index 96bafea..1bedac0 100644
--- a/Tests/CompileOptions/CMakeLists.txt
+++ b/Tests/CompileOptions/CMakeLists.txt
@@ -65,6 +65,10 @@
   string(APPEND CMAKE_CXX_FLAGS_RELEASE        " -DFLAG_A=2 -DFLAG_C=1")
   string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DFLAG_A=2 -DFLAG_C=1")
   string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL     " -DFLAG_A=2 -DFLAG_C=1")
+  string(TOUPPER "${CMAKE_BUILD_TYPE}" _xbuild_type)
+  if(NOT _xbuild_type MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL)$")
+    string(APPEND CMAKE_CXX_FLAGS_${_xbuild_type} " -DFLAG_A=2 -DFLAG_C=1")
+  endif()
   set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DFLAG_B=2" "-DFLAG_C=2" "-DFLAG_D=1")
   set_property(TARGET testlib APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "-DFLAG_D=2")
   if(NOT CMAKE_GENERATOR MATCHES "^Visual Studio 9")
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 26714c4..ed8e725 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -407,11 +407,16 @@
   if(XCODE_VERSION VERSION_GREATER_EQUAL 12)
     xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
     xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
-    xctest_add_bundle_test(iOS iphoneos "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
-    xctest_add_bundle_test(iOS iphoneos "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>")
+    xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
+    if (XCODE_VERSION VERSION_LESS 12.5)
+      xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>")
+    else()
+      xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
+    endif()
   else()
     xctest_add_bundle_test(Darwin macosx "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
-    xctest_add_bundle_test(iOS iphoneos "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
+    xctest_add_bundle_test(iOS iphonesimulator "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns")
   endif()
 endif()
+
 # Please add macOS-only tests above before the device-specific tests.
diff --git a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake
index 444c730..9114fee 100644
--- a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake
+++ b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake
@@ -1,9 +1,14 @@
 enable_language(Swift)
+
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
 find_package(XCTest REQUIRED)
 
-add_executable(TestedApp MACOSX_BUNDLE EXCLUDE_FROM_ALL foo.swift)
+add_executable(TestedApp MACOSX_BUNDLE dummy_main.swift)
 
-xctest_add_bundle(TestingAppBundle TestedApp foo.swift)
+xctest_add_bundle(TestingAppBundle TestedApp dummy_main.swift)
 
 get_target_property(_lib_output_dir TestingAppBundle LIBRARY_OUTPUT_DIRECTORY)
 
diff --git a/Tests/RunCMake/XcodeProject/dummy_main.swift b/Tests/RunCMake/XcodeProject/dummy_main.swift
new file mode 100644
index 0000000..1aaee42
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/dummy_main.swift
@@ -0,0 +1,18 @@
+#if os(iOS)
+import UIKit
+
+@UIApplicationMain
+class MyApp: UIResponder, UIApplicationDelegate {
+}
+
+#elseif os(macOS)
+import SwiftUI
+
+@main
+struct MyApp: App {
+    var body: some Scene {
+        WindowGroup {
+        }
+    }
+}
+#endif