Imported Upstream version 3.20.4 upstream/3.20.4
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:52 +0000 (09:20 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:52 +0000 (09:20 +0900)
16 files changed:
Help/command/cmake_path.rst
Modules/Compiler/Clang.cmake
Modules/Compiler/MSVC-CXX.cmake
Modules/FindBoost.cmake
Modules/InstallRequiredSystemLibraries.cmake
Source/CMakeVersion.cmake
Source/cmCMakePresetsFile.cxx
Source/cmFileAPICodemodel.cxx
Source/cmGlobalVisualStudioVersionedGenerator.cxx
Source/cmMakefileTargetGenerator.cxx
Source/cmake.cxx
Templates/MSBuild/FlagTables/v142_CL.json
Tests/RunCMake/CMakeLists.txt
Tests/RunCMake/CMakePresetsBuild/Good.json.in
Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake

index a8999f3..e7a01ab 100644 (file)
@@ -459,9 +459,10 @@ are :ref:`normalized <Normalization>` before the check.
 
 .. code-block:: cmake
 
-  set(path "/a/b/c/d")
-  cmake_path(IS_PREFIX path "/a/b" result)    # result = true
-  cmake_path(IS_PREFIX path "/x/y/z" result)  # result = false
+  set(path "/a/b/c")
+  cmake_path(IS_PREFIX path "/a/b/c/d" result) # result = true
+  cmake_path(IS_PREFIX path "/a/b" result)     # result = false
+  cmake_path(IS_PREFIX path "/x/y/z" result)   # result = false
 
   set(path "/a/b")
   cmake_path(IS_PREFIX path "/a/c/../b" NORMALIZE result)   # result = true
index 9f93d41..7035d93 100644 (file)
@@ -194,16 +194,25 @@ macro(__compiler_clang_cxx_standards lang)
     set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "")
     set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std:c++14")
     set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std:c++14")
-    if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
+
+    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
       set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++17")
       set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++17")
-      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
-      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
     else()
       set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++latest")
       set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest")
     endif()
 
+    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
+      set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest")
+      set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest")
+      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20")
+      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20")
+    elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
+      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
+      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
+    endif()
+
     __compiler_check_default_language_standard(${lang} 3.9 14)
   else()
     # This version of clang-cl, or the MSVC version it simulates, does not have
index 1dfc760..f1c7450 100644 (file)
@@ -18,6 +18,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
   set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "")
   set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14")
   set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14")
+
   if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505)
     set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
     set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
@@ -27,7 +28,13 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
     set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest")
     set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest")
   endif()
-  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
+
+  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129)
+    set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++20")
+    set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++20")
+    set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest")
+    set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest")
+  elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
     set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
     set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest")
   endif()
index d31f925..df997e1 100644 (file)
@@ -1405,6 +1405,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
   set(_Boost_LOCALE_HEADERS              "boost/locale.hpp")
   set(_Boost_LOG_HEADERS                 "boost/log/core.hpp")
   set(_Boost_LOG_SETUP_HEADERS           "boost/log/detail/setup_config.hpp")
+  set(_Boost_JSON_HEADERS                "boost/json.hpp")
   set(_Boost_MATH_HEADERS                "boost/math_fwd.hpp")
   set(_Boost_MATH_C99_HEADERS            "boost/math/tr1.hpp")
   set(_Boost_MATH_C99F_HEADERS           "boost/math/tr1.hpp")
index 2d08e08..fa7b125 100644 (file)
@@ -80,7 +80,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
         set(_Intel_archdir ia32)
       endif()
       set(_Intel_compiler_ver ${CMAKE_${LANG}_COMPILER_VERSION})
-      if(WIN32)
+      if(WIN32 AND EXISTS "${_Intel_basedir}/../redist/${_Intel_archdir}_win/compiler")
+        get_filename_component(_Intel_redistdir "${_Intel_basedir}/../redist/${_Intel_archdir}_win/compiler" ABSOLUTE)
+      elseif(WIN32)
         get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../redist/${_Intel_archdir}/compiler" ABSOLUTE)
       elseif(APPLE)
         get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../compiler/lib" ABSOLUTE)
index 4e53775..89579dd 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 3)
+set(CMake_VERSION_PATCH 4)
 #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 [==[13d112ea03 CMake 3.20.3]==])
+  set(git_info [==[b61fe6a831 CMake 3.20.4]==])
 
   # 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 dda3661..16c2ed3 100644 (file)
@@ -184,8 +184,8 @@ auto const PresetVectorStringHelper =
     ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET,
     PresetStringHelper);
 
-ReadFileResult PresetInheritsHelper(std::vector<std::string>& out,
-                                    const Json::Value* value)
+ReadFileResult PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
+                                                 const Json::Value* value)
 {
   out.clear();
   if (!value) {
@@ -312,8 +312,8 @@ auto const ConfigurePresetHelper =
   cmJSONObjectHelper<ConfigurePreset, ReadFileResult>(
     ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
     .Bind("name"_s, &ConfigurePreset::Name, PresetStringHelper)
-    .Bind("inherits"_s, &ConfigurePreset::Inherits, PresetInheritsHelper,
-          false)
+    .Bind("inherits"_s, &ConfigurePreset::Inherits,
+          PresetVectorOneOrMoreStringHelper, false)
     .Bind("hidden"_s, &ConfigurePreset::Hidden, PresetBoolHelper, false)
     .Bind<std::nullptr_t>("vendor"_s, nullptr,
                           VendorHelper(ReadFileResult::INVALID_PRESET), false)
@@ -340,7 +340,8 @@ auto const BuildPresetHelper =
   cmJSONObjectHelper<BuildPreset, ReadFileResult>(
     ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
     .Bind("name"_s, &BuildPreset::Name, PresetStringHelper)
-    .Bind("inherits"_s, &BuildPreset::Inherits, PresetInheritsHelper, false)
+    .Bind("inherits"_s, &BuildPreset::Inherits,
+          PresetVectorOneOrMoreStringHelper, false)
     .Bind("hidden"_s, &BuildPreset::Hidden, PresetBoolHelper, false)
     .Bind<std::nullptr_t>("vendor"_s, nullptr,
                           VendorHelper(ReadFileResult::INVALID_PRESET), false)
@@ -356,7 +357,8 @@ auto const BuildPresetHelper =
           &BuildPreset::InheritConfigureEnvironment, PresetOptionalBoolHelper,
           false)
     .Bind("jobs"_s, &BuildPreset::Jobs, PresetOptionalIntHelper, false)
-    .Bind("targets"_s, &BuildPreset::Targets, PresetVectorStringHelper, false)
+    .Bind("targets"_s, &BuildPreset::Targets,
+          PresetVectorOneOrMoreStringHelper, false)
     .Bind("configuration"_s, &BuildPreset::Configuration, PresetStringHelper,
           false)
     .Bind("cleanFirst"_s, &BuildPreset::CleanFirst, PresetOptionalBoolHelper,
@@ -657,7 +659,8 @@ auto const TestPresetHelper =
   cmJSONObjectHelper<TestPreset, ReadFileResult>(
     ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
     .Bind("name"_s, &TestPreset::Name, PresetStringHelper)
-    .Bind("inherits"_s, &TestPreset::Inherits, PresetInheritsHelper, false)
+    .Bind("inherits"_s, &TestPreset::Inherits,
+          PresetVectorOneOrMoreStringHelper, false)
     .Bind("hidden"_s, &TestPreset::Hidden, PresetBoolHelper, false)
     .Bind<std::nullptr_t>("vendor"_s, nullptr,
                           VendorHelper(ReadFileResult::INVALID_PRESET), false)
index 9061109..c96eecd 100644 (file)
@@ -27,7 +27,7 @@
 #include "cmInstallGenerator.h"
 #include "cmInstallSubdirectoryGenerator.h"
 #include "cmInstallTargetGenerator.h"
-#include "cmLinkLineComputer.h"
+#include "cmLinkLineComputer.h" // IWYU pragma: keep
 #include "cmListFileCache.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -1444,9 +1444,10 @@ Json::Value Target::DumpLinkCommandFragments()
   std::vector<BT<std::string>> linkPath;
   std::vector<BT<std::string>> linkLibs;
   cmLocalGenerator* lg = this->GT->GetLocalGenerator();
-  cmLinkLineComputer linkLineComputer(lg,
-                                      lg->GetStateSnapshot().GetDirectory());
-  lg->GetTargetFlags(&linkLineComputer, this->Config, linkLibs,
+  cmGlobalGenerator* gg = this->GT->GetGlobalGenerator();
+  std::unique_ptr<cmLinkLineComputer> linkLineComputer =
+    gg->CreateLinkLineComputer(lg, lg->GetStateSnapshot().GetDirectory());
+  lg->GetTargetFlags(linkLineComputer.get(), this->Config, linkLibs,
                      linkLanguageFlags, linkFlags, frameworkPath, linkPath,
                      this->GT);
   linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags);
index 9a9a465..c11ab1b 100644 (file)
@@ -504,6 +504,9 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset(
     if (version == "14.28.16.9" && vcToolsetVersion == "14.28.29910") {
       return AuxToolset::Default;
     }
+    if (version == "14.29.16.10" && vcToolsetVersion == "14.29.30037") {
+      return AuxToolset::Default;
+    }
 
     // The first two components of the default toolset version typically
     // match the name used by later VS versions for the SxS props files.
index 4918bf6..5f7f3dc 100644 (file)
@@ -926,8 +926,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
                                                    compileCommand, vars);
       std::string workingDirectory =
         this->LocalGenerator->GetCurrentBinaryDirectory();
-      compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
-                             this->GetFlags(lang, this->GetConfigName()));
+      std::string::size_type lfPos = compileCommand.find(langFlags);
+      if (lfPos != std::string::npos) {
+        compileCommand.replace(lfPos, langFlags.size(),
+                               this->GetFlags(lang, this->GetConfigName()));
+      }
       std::string langDefines = std::string("$(") + lang + "_DEFINES)";
       std::string::size_type ldPos = compileCommand.find(langDefines);
       if (ldPos != std::string::npos) {
index 4d03821..db8600f 100644 (file)
@@ -3164,7 +3164,9 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
     this->UnprocessedPresetEnvironment = expandedPreset->Environment;
     this->ProcessPresetEnvironment();
 
-    if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL && expandedPreset->Jobs) {
+    if ((jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL ||
+         jobs == cmake::NO_BUILD_PARALLEL_LEVEL) &&
+        expandedPreset->Jobs) {
       jobs = *expandedPreset->Jobs;
     }
 
index 7c2d291..3305e56 100644 (file)
     "flags": []
   },
   {
+    "name": "ExternalWarningLevel",
+    "switch": "external:W0",
+    "comment": "Turn Off All Warnings",
+    "value": "TurnOffAllWarnings",
+    "flags": []
+  },
+  {
+    "name": "ExternalWarningLevel",
+    "switch": "external:W1",
+    "comment": "Level1",
+    "value": "Level1",
+    "flags": []
+  },
+  {
+    "name": "ExternalWarningLevel",
+    "switch": "external:W2",
+    "comment": "Level2",
+    "value": "Level2",
+    "flags": []
+  },
+  {
+    "name": "ExternalWarningLevel",
+    "switch": "external:W3",
+    "comment": "Level3",
+    "value": "Level3",
+    "flags": []
+  },
+  {
+    "name": "ExternalWarningLevel",
+    "switch": "external:W4",
+    "comment": "Level4",
+    "value": "Level4",
+    "flags": []
+  },
+  {
     "name": "CallingConvention",
     "switch": "Gd",
     "comment": "__cdecl",
index 78e0b6a..c81796c 100644 (file)
@@ -809,9 +809,19 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
   -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
 
 add_RunCMake_test("UnityBuild")
-add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(CMakePresetsBuild -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(CMakePresetsTest -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
+add_RunCMake_test(CMakePresets
+  -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+  -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+  )
+add_RunCMake_test(CMakePresetsBuild
+  -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+  -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+  -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+  )
+add_RunCMake_test(CMakePresetsTest
+  -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+  -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+  )
 
 if(${CMAKE_GENERATOR} MATCHES "Make|Ninja")
   add_RunCMake_test(TransformDepfile)
index fd43c4e..c7f318c 100644 (file)
@@ -30,7 +30,7 @@
             "description": "",
             "inheritConfigureEnvironment": true,
             "environment": {},
-            "jobs": 0,
+            @Good_json_jobs@
             "targets": [],
             "configuration": "",
             "verbose": true,
             "vendor": {
                 "example.com": "value"
             }
+        },
+        {
+            "name": "singleTarget",
+            "inherits": "build-default",
+            "targets": "good"
         }
     ]
 }
index 2559b12..a05ad9f 100644 (file)
@@ -62,7 +62,15 @@ endfunction()
 
 set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
 
-run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject")
+if(RunCMake_GENERATOR MATCHES "NMake|Borland|Watcom")
+  set(Good_json_jobs [[]])
+elseif(RunCMake_GENERATOR MATCHES "Make" AND CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  set(Good_json_jobs [["jobs": 1,]])
+else()
+  set(Good_json_jobs [["jobs": 0,]])
+endif()
+
+run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject;singleTarget")
 run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset")
 
 set(CMakePresetsBuild_BUILD_ONLY 1)
index 12368a2..b1b120f 100644 (file)
@@ -1,5 +1,6 @@
 enable_language(C)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 add_library(empty STATIC empty.c)
 string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
 string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+string(REPLACE "<FLAGS>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")