Merge topic 'ninja-remove-param-default'

cfe2dc4721 Ninja: Remove parameter default for cmNinjaTargetDepends

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5059
diff --git a/Help/release/dev/EXCLUDE_FROM_ALL-genex.rst b/Help/release/dev/EXCLUDE_FROM_ALL-genex.rst
new file mode 100644
index 0000000..4d5a83c
--- /dev/null
+++ b/Help/release/dev/EXCLUDE_FROM_ALL-genex.rst
@@ -0,0 +1,5 @@
+EXCLUDE_FROM_ALL-genex
+----------------------
+
+* The :prop_tgt:`EXCLUDE_FROM_ALL` target property gained support for
+  :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3a47090..aecc00b 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1124,7 +1124,11 @@
     message(FATAL_ERROR "Tag for git checkout should not be empty.")
   endif()
 
-  set(git_clone_options "--no-checkout")
+  if(GIT_VERSION_STRING VERSION_LESS 2.20 OR 2.21 VERSION_LESS_EQUAL GIT_VERSION_STRING)
+    set(git_clone_options "--no-checkout")
+  else()
+    set(git_clone_options)
+  endif()
   if(git_shallow)
     if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.10)
       list(APPEND git_clone_options "--depth 1 --no-single-branch")
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
index ca9195c..a7fb766 100644
--- a/Modules/FindXalanC.cmake
+++ b/Modules/FindXalanC.cmake
@@ -49,9 +49,9 @@
 function(_XalanC_GET_VERSION  version_hdr)
     file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XALAN_VERSION_.*")
     if(_contents)
-        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}")
-        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}")
-        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}")
+        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t(]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}")
+        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t(]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}")
+        string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t(]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}")
 
         if(NOT XalanC_MAJOR MATCHES "^[0-9]+$")
             message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MAJOR!")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0fea915..0465c93 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 20200724)
+set(CMake_VERSION_PATCH 20200727)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5c07e31..17c7e99 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2189,7 +2189,7 @@
     // configurations.
     if (trueCount && falseCount) {
       std::ostringstream e;
-      e << "The EXCLUDED_FROM_ALL property of target \"" << target->GetName()
+      e << "The EXCLUDE_FROM_ALL property of target \"" << target->GetName()
         << "\" varies by configuration. This is not supported by the \""
         << root->GetGlobalGenerator()->GetName() << "\" generator.";
       mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e54de5d..f632257 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3753,6 +3753,8 @@
   if (this->XcodeVersion >= 100) {
     xout.Element("key", "BuildSystemType");
     xout.Element("string", "Original");
+    xout.Element("key", "DisableBuildSystemDeprecationWarning");
+    xout.Element("true");
   }
   if (hasGeneratedSchemes) {
     xout.Element("key",
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f291cbd..a06dab3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2919,6 +2919,12 @@
     clOptions.RemoveFlag("SpectreMitigation");
   }
 
+  // Remove any target-wide -TC or -TP flag added by the project.
+  // Such flags are unnecessary and break our model of language selection.
+  if (langForClCompile == "C" || langForClCompile == "CXX") {
+    clOptions.RemoveFlag("CompileAs");
+  }
+
   this->ClOptions[configName] = std::move(pOptions);
   return true;
 }
diff --git a/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake
index 25201e4..2b4fc89 100644
--- a/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake
@@ -9,7 +9,7 @@
         -DCMAKE_BUILD_TYPE=${config}
         -DTOOL_EXCLUDE_FROM_ALL=${exclude_from_all_value})
     set(RunCMake_TEST_NO_CLEAN 1)
-    include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+    include(${RunCMake_TEST_BINARY_DIR}/target_files_${config}.cmake)
     run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config ${config})
 endfunction()
 
diff --git a/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt
index eee5278..6dc785f 100644
--- a/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt
+++ b/Tests/RunCMake/ExcludeFromAll/error-on-mixed-config-stderr.txt
@@ -1,3 +1,3 @@
 CMake Error in CMakeLists.txt:
-  The EXCLUDED_FROM_ALL property of target "release_only_tool" varies by
+  The EXCLUDE_FROM_ALL property of target "release_only_tool" varies by
   configuration.  This is not supported by the "[^"]+"
diff --git a/Tests/RunCMake/ExcludeFromAll/main.c b/Tests/RunCMake/ExcludeFromAll/main.c
index 5047a34..f8b643a 100644
--- a/Tests/RunCMake/ExcludeFromAll/main.c
+++ b/Tests/RunCMake/ExcludeFromAll/main.c
@@ -1,3 +1,4 @@
 int main()
 {
+  return 0;
 }
diff --git a/Tests/RunCMake/ExcludeFromAll/single-config.cmake b/Tests/RunCMake/ExcludeFromAll/single-config.cmake
index 71a9f06..aa49c21 100644
--- a/Tests/RunCMake/ExcludeFromAll/single-config.cmake
+++ b/Tests/RunCMake/ExcludeFromAll/single-config.cmake
@@ -2,10 +2,6 @@
 add_executable(tool main.c)
 set_property(TARGET tool PROPERTY EXCLUDE_FROM_ALL "${TOOL_EXCLUDE_FROM_ALL}")
 
-include(../NinjaMultiConfig/Common.cmake)
-set(orig_CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES})
-if("${CMAKE_CONFIGURATION_TYPES}" STREQUAL "")
-    set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
-endif()
-generate_output_files(tool)
-set(CMAKE_CONFIGURATION_TYPES ${orig_CMAKE_CONFIGURATION_TYPES})
+file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/target_files_$<CONFIG>.cmake" CONTENT [[
+set(TARGET_FILE_tool_$<CONFIG> [==[$<TARGET_FILE:tool>]==])
+]])
diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt
index af90f11..616421e 100644
--- a/Tests/SetLang/CMakeLists.txt
+++ b/Tests/SetLang/CMakeLists.txt
@@ -9,6 +9,13 @@
 target_link_libraries(SetLang foo)
 set_target_properties(SetLang PROPERTIES LINKER_LANGUAGE CXX)
 
+# VS generators historically tolerated target-wide -TP flags added
+# by project code, so cover that case to preserve the behavior.
+if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+  add_library(stay stay_c.c stay_cxx.cxx)
+  set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP")
+endif()
+
 if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
   add_library(zoom zoom.zzz)
   set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX)
diff --git a/Tests/SetLang/stay_c.c b/Tests/SetLang/stay_c.c
new file mode 100644
index 0000000..70755f3
--- /dev/null
+++ b/Tests/SetLang/stay_c.c
@@ -0,0 +1,8 @@
+#ifdef __cplusplus
+#  error C source incorrectly compiled as C++
+#endif
+
+int stay_c(void)
+{
+  return 0;
+}
diff --git a/Tests/SetLang/stay_cxx.cxx b/Tests/SetLang/stay_cxx.cxx
new file mode 100644
index 0000000..e035260
--- /dev/null
+++ b/Tests/SetLang/stay_cxx.cxx
@@ -0,0 +1,8 @@
+#ifndef __cplusplus
+#  error C++ source incorrectly compiled as C
+#endif
+
+int stay_cxx()
+{
+  return 0;
+}
diff --git a/Utilities/std/cm/bits/fs_path.cxx b/Utilities/std/cm/bits/fs_path.cxx
index b8c5631..8089998 100644
--- a/Utilities/std/cm/bits/fs_path.cxx
+++ b/Utilities/std/cm/bits/fs_path.cxx
@@ -331,7 +331,7 @@
     while (ptr != end &&
            (*ptr == '/'
 #  if defined(_WIN32)
-            || *ptr == ' \\'
+            || *ptr == '\\'
 #  endif
             )) {
       ptr += step;
diff --git a/bootstrap b/bootstrap
index 0134e0c..2ef0fbb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1188,7 +1188,7 @@
 }
 #endif
 
-#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_if_constexpr))
+#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides))
 #include <optional>
 template <typename T,
           typename std::invoke_result<decltype(&T::get), T>::type = nullptr>