Imported Upstream version 3.20.5 upstream/3.20.5
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:54 +0000 (09:20 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:54 +0000 (09:20 +0900)
15 files changed:
Help/release/3.20.rst
Modules/ExternalProject-gitupdate.cmake.in
Source/CMakeVersion.cmake
Source/cmCommands.cxx
Source/cmGlobalVisualStudio10Generator.cxx
Source/cmGlobalVisualStudio10Generator.h
Source/cmGlobalVisualStudioVersionedGenerator.cxx
Source/cmGlobalVisualStudioVersionedGenerator.h
Source/cmState.cxx
Source/cmState.h
Tests/BuildDepends/Project/CMakeLists.txt
Tests/CMakeLists.txt
Tests/RunCMake/Syntax/OverrideProject-result.txt [new file with mode: 0644]
Tests/RunCMake/Syntax/OverrideProject-stderr.txt [new file with mode: 0644]
Tests/RunCMake/Syntax/RunCMakeTest.cmake

index f77304f..da27174 100644 (file)
@@ -362,3 +362,10 @@ Changes made since CMake 3.20.0 include the following.
   a special case to recognize oneAPI 2021.1 Fortran as ``IntelLLVM``.
   The oneAPI 2021.2 Fortran compiler defines the proper identification
   macro and so is identified as ``IntelLLVM`` by all CMake 3.20 versions.
+
+3.20.3, 3.20.4, 3.20.5
+----------------------
+
+These versions made no changes to documented features or interfaces.
+Some implementation updates were made to support ecosystem changes
+and/or fix regressions.
index 461e323..0de2372 100644 (file)
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5)
 
 function(get_hash_for_ref ref out_var err_var)
   execute_process(
-    COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^{commit}"
+    COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^0"
     WORKING_DIRECTORY "@work_dir@"
     RESULT_VARIABLE error_code
     OUTPUT_VARIABLE ref_hash
index 89579dd..7a14f55 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 4)
+set(CMake_VERSION_PATCH 5)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
@@ -21,7 +21,7 @@ endif()
 
 if(NOT CMake_VERSION_NO_GIT)
   # If this source was exported by 'git archive', use its commit info.
-  set(git_info [==[b61fe6a831 CMake 3.20.4]==])
+  set(git_info [==[efa5e1f367 CMake 3.20.5]==])
 
   # Otherwise, try to identify the current development source version.
   if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
index 9e5b783..a241a3a 100644 (file)
@@ -164,36 +164,36 @@ void GetScriptingCommands(cmState* state)
   state->AddBuiltinCommand("string", cmStringCommand);
   state->AddBuiltinCommand("unset", cmUnsetCommand);
 
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "else",
     "An ELSE command was found outside of a proper "
     "IF ENDIF structure. Or its arguments did not match "
     "the opening IF command.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "elseif",
     "An ELSEIF command was found outside of a proper "
     "IF ENDIF structure.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "endforeach",
     "An ENDFOREACH command was found outside of a proper "
     "FOREACH ENDFOREACH structure. Or its arguments did "
     "not match the opening FOREACH command.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "endfunction",
     "An ENDFUNCTION command was found outside of a proper "
     "FUNCTION ENDFUNCTION structure. Or its arguments did not "
     "match the opening FUNCTION command.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "endif",
     "An ENDIF command was found outside of a proper "
     "IF ENDIF structure. Or its arguments did not match "
     "the opening IF command.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "endmacro",
     "An ENDMACRO command was found outside of a proper "
     "MACRO ENDMACRO structure. Or its arguments did not "
     "match the opening MACRO command.");
-  state->AddUnexpectedCommand(
+  state->AddUnexpectedFlowControlCommand(
     "endwhile",
     "An ENDWHILE command was found outside of a proper "
     "WHILE ENDWHILE structure. Or its arguments did not "
index badce2e..b911eef 100644 (file)
@@ -1313,8 +1313,12 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
   return value;
 }
 
-static cmIDEFlagTable const* cmLoadFlagTableJson(
-  std::string const& flagJsonPath)
+namespace {
+
+unsigned long long const vsVer16_10_0 = 4503644629696790;
+
+cmIDEFlagTable const* cmLoadFlagTableJson(
+  std::string const& flagJsonPath, cm::optional<unsigned long long> vsver)
 {
   cmIDEFlagTable* ret = nullptr;
   auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
@@ -1336,6 +1340,11 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
           flagEntry.comment = cmLoadFlagTableString(flag, "comment");
           flagEntry.value = cmLoadFlagTableString(flag, "value");
           flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
+          // FIXME: Port this version check to a Json field.
+          if (vsver && *vsver < vsVer16_10_0 &&
+              flagEntry.IDEName == "ExternalWarningLevel") {
+            continue;
+          }
           flagTable.push_back(flagEntry);
         }
         cmIDEFlagTable endFlag{ "", "", "", "", 0 };
@@ -1349,12 +1358,13 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
   return ret;
 }
 
-static std::string cmGetFlagTableName(std::string const& toolsetName,
-                                      std::string const& table)
+std::string cmGetFlagTableName(std::string const& toolsetName,
+                               std::string const& table)
 {
   return cmSystemTools::GetCMakeRoot() + "/Templates/MSBuild/FlagTables/" +
     toolsetName + "_" + table + ".json";
 }
+}
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
   std::string const& optionsName, std::string const& toolsetName,
@@ -1362,17 +1372,19 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
 {
   cmIDEFlagTable const* ret = nullptr;
 
+  cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion();
+
   std::string filename;
   if (!optionsName.empty()) {
     filename = cmGetFlagTableName(optionsName, table);
-    ret = cmLoadFlagTableJson(filename);
+    ret = cmLoadFlagTableJson(filename, vsver);
   } else {
     filename = cmGetFlagTableName(toolsetName, table);
     if (cmSystemTools::FileExists(filename)) {
-      ret = cmLoadFlagTableJson(filename);
+      ret = cmLoadFlagTableJson(filename, vsver);
     } else {
       filename = cmGetFlagTableName(defaultName, table);
-      ret = cmLoadFlagTableJson(filename);
+      ret = cmLoadFlagTableJson(filename, vsver);
     }
   }
 
index 8d30ef8..5022a0f 100644 (file)
@@ -5,6 +5,8 @@
 #include <memory>
 #include <set>
 
+#include <cm/optional>
+
 #include "cmGlobalVisualStudio8Generator.h"
 #include "cmVisualStudio10ToolsetOptions.h"
 
@@ -119,6 +121,11 @@ public:
   std::string Encoding() override;
   const char* GetToolsVersion() const;
 
+  virtual cm::optional<unsigned long long> GetVSInstanceVersion() const
+  {
+    return {};
+  }
+
   bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
 
   bool FindMakeProgram(cmMakefile* mf) override;
index c11ab1b..50dc30b 100644 (file)
@@ -391,10 +391,15 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
   return vsSetupAPIHelper.GetVSInstanceInfo(dir);
 }
 
-bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion(
-  unsigned long long& vsInstanceVersion) const
+cm::optional<unsigned long long>
+cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const
 {
-  return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion);
+  cm::optional<unsigned long long> result;
+  unsigned long long vsInstanceVersion;
+  if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) {
+    result = vsInstanceVersion;
+  }
+  return result;
 }
 
 bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
@@ -407,9 +412,9 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
     return false;
   }
   unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212;
-  unsigned long long vsInstanceVersion;
-  return (this->GetVSInstanceVersion(vsInstanceVersion) &&
-          vsInstanceVersion > vsInstanceVersion16_7_P2);
+  cm::optional<unsigned long long> vsInstanceVersion =
+    this->GetVSInstanceVersion();
+  return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2);
 }
 
 const char*
index cee129e..105e495 100644 (file)
@@ -28,7 +28,7 @@ public:
 
   bool GetVSInstance(std::string& dir) const;
 
-  bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const;
+  cm::optional<unsigned long long> GetVSInstanceVersion() const override;
 
   AuxToolset FindAuxToolset(std::string& version,
                             std::string& props) const override;
index d97762b..929b0fb 100644 (file)
@@ -480,7 +480,7 @@ void cmState::AddDisallowedCommand(std::string const& name,
 
 void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
 {
-  this->AddFlowControlCommand(
+  this->AddBuiltinCommand(
     name,
     [name, error](std::vector<cmListFileArgument> const&,
                   cmExecutionStatus& status) -> bool {
@@ -495,6 +495,13 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
     });
 }
 
+void cmState::AddUnexpectedFlowControlCommand(std::string const& name,
+                                              const char* error)
+{
+  this->FlowControlCommands.insert(name);
+  this->AddUnexpectedCommand(name, error);
+}
+
 bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command,
                                  cmMakefile& mf)
 {
index 4e41156..9951b9a 100644 (file)
@@ -166,6 +166,8 @@ public:
   void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
                             cmPolicies::PolicyID policy, const char* message);
   void AddUnexpectedCommand(std::string const& name, const char* error);
+  void AddUnexpectedFlowControlCommand(std::string const& name,
+                                       const char* error);
   bool AddScriptedCommand(std::string const& name, BT<Command> command,
                           cmMakefile& mf);
   void RemoveBuiltinCommand(std::string const& name);
index c2576f3..7fddf4b 100644 (file)
@@ -8,7 +8,7 @@ if(APPLE)
   else()
     execute_process(
       COMMAND xcodebuild -version
-      OUTPUT_VARIABLE _version ERROR_VARIABLE _version
+      OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
       )
     if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
       set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
index 8e7c04f..bb83fea 100644 (file)
@@ -321,7 +321,7 @@ if(BUILD_TESTING)
     else()
       execute_process(
         COMMAND xcodebuild -version
-        OUTPUT_VARIABLE _version ERROR_VARIABLE _version
+        OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
         )
       if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
         set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
diff --git a/Tests/RunCMake/Syntax/OverrideProject-result.txt b/Tests/RunCMake/Syntax/OverrideProject-result.txt
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/OverrideProject-stderr.txt b/Tests/RunCMake/Syntax/OverrideProject-stderr.txt
new file mode 100644 (file)
index 0000000..862d5c8
--- /dev/null
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/Tests/RunCMake/Syntax/Override\.cmake:[0-9]+ \(message\):
+  This shouldn't happen$
index 4d24657..f0c287c 100644 (file)
@@ -150,3 +150,4 @@ run_override(If)
 run_override(Macro)
 run_override(Return)
 run_override(While)
+run_override(Project)