This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  fdb41a5102e1fef50fb918eba5f84cfc19a62734 (commit)
       via  b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565 (commit)
       via  e7d57bc3c35e7c47746caf91591ef748b9ce3012 (commit)
       via  45b4b4b93076e16281ecee628ef8ffb0aae8f3d6 (commit)
       via  4bedf6c9fa3f55a19b09d5ab26cfd149ee2e13e6 (commit)
       via  548e9051a4f20657d04341107924171ea9d1bcb5 (commit)
       via  99e83d423500e11a8e85c2032e8c536bce175ed1 (commit)
      from  c867981c9d9bc8548d34f726940cd50b8d05d71c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdb41a5102e1fef50fb918eba5f84cfc19a62734
commit fdb41a5102e1fef50fb918eba5f84cfc19a62734
Merge: b34b4c5eac 4bedf6c9fa
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Oct 18 13:01:57 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Oct 18 09:02:29 2019 -0400

    Merge topic 'variable_watch-modernize'
    
    4bedf6c9fa Refactor: Modernize `cmVariableWatchCommand` a little
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3892


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565
commit b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565
Merge: c867981c9d e7d57bc3c3
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Oct 18 13:01:36 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Oct 18 09:01:48 2019 -0400

    Merge topic 'vs-vctargetspath'
    
    e7d57bc3c3 VS: Propagate CMAKE_VS_GLOBALS into custom targets
    45b4b4b930 VS: Propagate CMAKE_VS_GLOBALS into compiler id projects
    548e9051a4 VS: Add support to override VCTargetsPath through toolset
    99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3817


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7d57bc3c35e7c47746caf91591ef748b9ce3012
commit e7d57bc3c35e7c47746caf91591ef748b9ce3012
Author:     Alexander Boczar <alex...@microsoft.com>
AuthorDate: Mon Sep 16 16:55:26 2019 -0700
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Oct 17 10:19:01 2019 -0400

    VS: Propagate CMAKE_VS_GLOBALS into custom targets
    
    Issue: #19708

diff --git a/Help/release/dev/vs-vctargetspath.rst 
b/Help/release/dev/vs-vctargetspath.rst
index 462d183b2a..d40af349e4 100644
--- a/Help/release/dev/vs-vctargetspath.rst
+++ b/Help/release/dev/vs-vctargetspath.rst
@@ -6,4 +6,5 @@ vs-vctargetspath
   to specify the ``VCTargetsPath`` value for project files.
 
 * The :variable:`CMAKE_VS_GLOBALS` variable value now applies during
-  compiler identification.
+  compiler identification and in targets created by the
+  :command:`add_custom_target` command.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 99c16f2374..a4f904b155 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -511,8 +511,7 @@ cmTarget::cmTarget(std::string const& name, 
cmStateEnums::TargetType type,
     initProp("DOTNET_TARGET_FRAMEWORK_VERSION");
   }
 
-  if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
-      this->GetType() != cmStateEnums::UTILITY) {
+  if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
 
     // check for "CMAKE_VS_GLOBALS" variable and set up target properties
     // if any

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45b4b4b93076e16281ecee628ef8ffb0aae8f3d6
commit 45b4b4b93076e16281ecee628ef8ffb0aae8f3d6
Author:     Alexander Boczar <boc...@hotmail.com>
AuthorDate: Thu Sep 26 17:37:47 2019 -0700
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Oct 17 10:18:52 2019 -0400

    VS: Propagate CMAKE_VS_GLOBALS into compiler id projects
    
    Issue: #19708

diff --git a/Help/release/dev/vs-vctargetspath.rst 
b/Help/release/dev/vs-vctargetspath.rst
index ff9d148134..462d183b2a 100644
--- a/Help/release/dev/vs-vctargetspath.rst
+++ b/Help/release/dev/vs-vctargetspath.rst
@@ -4,3 +4,6 @@ vs-vctargetspath
 * With :ref:`Visual Studio Generators` for VS 2010 and above,
   the :variable:`CMAKE_GENERATOR_TOOLSET` setting gained an option
   to specify the ``VCTargetsPath`` value for project files.
+
+* The :variable:`CMAKE_VS_GLOBALS` variable value now applies during
+  compiler identification.
diff --git a/Modules/CMakeDetermineCompilerId.cmake 
b/Modules/CMakeDetermineCompilerId.cmake
index 976b291220..f7ef755aeb 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -320,6 +320,12 @@ Id flags: ${testflags} 
${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
     if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR)
       set(id_ToolsetVCTargetsDir 
"<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>")
     endif()
+    set(id_CustomGlobals "")
+    foreach(pair IN LISTS CMAKE_VS_GLOBALS)
+      if("${pair}" MATCHES "([^=]+)=(.*)$")
+        string(APPEND id_CustomGlobals 
"<${CMAKE_MATCH_1}>${CMAKE_MATCH_2}</${CMAKE_MATCH_1}>\n    ")
+      endif()
+    endforeach()
     if(id_platform STREQUAL ARM64)
       set(id_WindowsSDKDesktopARMSupport 
"<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>")
     elseif(id_platform STREQUAL ARM)
diff --git a/Modules/CompilerId/VS-10.vcxproj.in 
b/Modules/CompilerId/VS-10.vcxproj.in
index a3814dc0e5..b48a3323f9 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -16,6 +16,7 @@
     @id_WindowsSDKDesktopARMSupport@
     @id_CudaToolkitCustomDir@
     @id_ToolsetVCTargetsDir@
+    @id_CustomGlobals@
   </PropertyGroup>
   @id_toolset_version_props@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
diff --git a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake 
b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake
index 0e7fd45c10..6a300991dd 100644
--- a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake
@@ -1,44 +1,65 @@
-set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
-if(NOT EXISTS "${vcProjectFile}")
-  set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
-  return()
-endif()
+macro(check_project_file projectFile)
+  if(NOT EXISTS "${projectFile}")
+    set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.")
+    return()
+  endif()
+
+  string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile})
 
-set(InsideGlobals FALSE)
-set(DefaultLanguageSet FALSE)
-set(MinimumVisualStudioVersionSet FALSE)
+  set(InsideGlobals FALSE)
+  set(DefaultLanguageSet FALSE)
+  set(MinimumVisualStudioVersionSet FALSE)
+  set(TestPropertySet FALSE)
 
-file(STRINGS "${vcProjectFile}" lines)
-foreach(line IN LISTS lines)
-  if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$")
-    set(InsideGlobals TRUE)
-  elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> 
*$")
-    if("${CMAKE_MATCH_1}" STREQUAL "en-US")
-      if(InsideGlobals)
-        message(STATUS "foo.vcxproj has correct DefaultLanguage global 
property")
-        set(DefaultLanguageSet TRUE)
-      else()
-        message(STATUS "DefaultLanguage is set but not within \"Globals\" 
property group")
+  file(STRINGS "${projectFile}" lines)
+  foreach(line IN LISTS lines)
+    if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$")
+      set(InsideGlobals TRUE)
+    elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> 
*$")
+      if("${CMAKE_MATCH_1}" STREQUAL "en-US")
+        if(InsideGlobals)
+          message(STATUS "${projectName} has correct DefaultLanguage global 
property")
+          set(DefaultLanguageSet TRUE)
+        else()
+          message(STATUS "DefaultLanguage is set but not within \"Globals\" 
property group")
+        endif()
       endif()
-    endif()
-  elseif(line MATCHES "^ 
*<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$")
-    if("${CMAKE_MATCH_1}" STREQUAL "14.0")
-      if(InsideGlobals)
-        message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion 
global property")
-        set(MinimumVisualStudioVersionSet TRUE)
-      else()
-        message(STATUS "MinimumVisualStudioVersion is set but not within 
\"Globals\" property group")
+    elseif(line MATCHES "^ 
*<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$")
+      if("${CMAKE_MATCH_1}" STREQUAL "10.0")
+        if(InsideGlobals)
+          message(STATUS "${projectName} has correct 
MinimumVisualStudioVersion global property")
+          set(MinimumVisualStudioVersionSet TRUE)
+        else()
+          message(STATUS "MinimumVisualStudioVersion is set but not within 
\"Globals\" property group")
+        endif()
+      endif()
+    elseif(line MATCHES "^ *<TestProperty>(.+)</TestProperty> *$")
+      if("${CMAKE_MATCH_1}" STREQUAL "TestValue")
+        if(InsideGlobals)
+          message(STATUS "${projectName} has correct TestProperty global 
property")
+          set(TestPropertySet TRUE)
+        else()
+          message(STATUS "TestProperty is set but not within \"Globals\" 
property group")
+        endif()
       endif()
     endif()
+  endforeach()
+
+  if(NOT DefaultLanguageSet)
+    set(RunCMake_TEST_FAILED "DefaultLanguage not found or not set correctly 
in ${projectName}.")
+    return()
+  endif()
+
+  if(NOT MinimumVisualStudioVersionSet)
+    set(RunCMake_TEST_FAILED "MinimumVisualStudioVersion not found or not set 
correctly in ${projectName}.")
+    return()
   endif()
-endforeach()
 
-if(NOT DefaultLanguageSet)
-  set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set 
correctly.")
-  return()
-endif()
+  if(NOT TestPropertySet)
+    set(RunCMake_TEST_FAILED "TestProperty not found or not set correctly in 
${projectName}.")
+    return()
+  endif()
+endmacro()
 
-if(NOT MinimumVisualStudioVersionSet)
-  set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set 
correctly.")
-  return()
-endif()
+check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj")
+check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
diff --git a/Tests/RunCMake/VS10Project/VsGlobals.cmake 
b/Tests/RunCMake/VS10Project/VsGlobals.cmake
index a3ed5afa9b..09d806dfb2 100644
--- a/Tests/RunCMake/VS10Project/VsGlobals.cmake
+++ b/Tests/RunCMake/VS10Project/VsGlobals.cmake
@@ -1,8 +1,9 @@
-enable_language(CXX)
-
 set(CMAKE_VS_GLOBALS
     "DefaultLanguage=en-US"
-    "MinimumVisualStudioVersion=14.0"
+    "MinimumVisualStudioVersion=10.0"
+    "TestProperty=TestValue"
 )
 
+enable_language(CXX)
+
 add_library(foo foo.cpp)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bedf6c9fa3f55a19b09d5ab26cfd149ee2e13e6
commit 4bedf6c9fa3f55a19b09d5ab26cfd149ee2e13e6
Author:     Alex Turbov <i.za...@gmail.com>
AuthorDate: Sun Oct 6 00:23:17 2019 +0200
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Oct 17 09:38:31 2019 -0400

    Refactor: Modernize `cmVariableWatchCommand` a little

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 4995da972f..35e1c8c56f 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -2,19 +2,19 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmVariableWatch.h"
 
+#include <array>
 #include <memory>
 #include <utility>
 #include <vector>
 
-static const char* const cmVariableWatchAccessStrings[] = {
-  "READ_ACCESS",     "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
-  "MODIFIED_ACCESS", "REMOVED_ACCESS",      "NO_ACCESS"
-};
-
-const char* cmVariableWatch::GetAccessAsString(int access_type)
+const std::string& cmVariableWatch::GetAccessAsString(int access_type)
 {
+  static const std::array<std::string, 6> cmVariableWatchAccessStrings = {
+    { "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
+      "MODIFIED_ACCESS", "REMOVED_ACCESS", "NO_ACCESS" }
+  };
   if (access_type < 0 || access_type >= cmVariableWatch::NO_ACCESS) {
-    return "NO_ACCESS";
+    access_type = cmVariableWatch::NO_ACCESS;
   }
   return cmVariableWatchAccessStrings[access_type];
 }
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index e4b3b7c47f..6c418ed0ab 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -46,7 +46,7 @@ public:
    */
   enum
   {
-    VARIABLE_READ_ACCESS = 0,
+    VARIABLE_READ_ACCESS,
     UNKNOWN_VARIABLE_READ_ACCESS,
     UNKNOWN_VARIABLE_DEFINED_ACCESS,
     VARIABLE_MODIFIED_ACCESS,
@@ -57,7 +57,7 @@ public:
   /**
    * Return the access as string
    */
-  static const char* GetAccessAsString(int access_type);
+  static const std::string& GetAccessAsString(int access_type);
 
 protected:
   struct Pair
diff --git a/Source/cmVariableWatchCommand.cxx 
b/Source/cmVariableWatchCommand.cxx
index f2c8f3cdb9..039f1ba6ba 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmVariableWatchCommand.h"
 
+#include <limits>
 #include <memory>
 #include <utility>
 
@@ -14,17 +15,17 @@
 #include "cmVariableWatch.h"
 #include "cmake.h"
 
+namespace {
 struct cmVariableWatchCallbackData
 {
   bool InCallback;
   std::string Command;
 };
 
-static void cmVariableWatchCommandVariableAccessed(const std::string& variable,
-                                                   int access_type,
-                                                   void* client_data,
-                                                   const char* newValue,
-                                                   const cmMakefile* mf)
+void cmVariableWatchCommandVariableAccessed(const std::string& variable,
+                                            int access_type, void* client_data,
+                                            const char* newValue,
+                                            const cmMakefile* mf)
 {
   cmVariableWatchCallbackData* data =
     static_cast<cmVariableWatchCallbackData*>(client_data);
@@ -34,40 +35,35 @@ static void cmVariableWatchCommandVariableAccessed(const 
std::string& variable,
   }
   data->InCallback = true;
 
-  cmListFileFunction newLFF;
-  cmListFileArgument arg;
-  bool processed = false;
-  const char* accessString = cmVariableWatch::GetAccessAsString(access_type);
-  const char* currentListFile = mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
+  auto accessString = cmVariableWatch::GetAccessAsString(access_type);
 
   /// Ultra bad!!
   cmMakefile* makefile = const_cast<cmMakefile*>(mf);
 
   std::string stack = makefile->GetProperty("LISTFILE_STACK");
   if (!data->Command.empty()) {
-    newLFF.Arguments.clear();
-    newLFF.Arguments.emplace_back(variable, cmListFileArgument::Quoted, 9999);
-    newLFF.Arguments.emplace_back(accessString, cmListFileArgument::Quoted,
-                                  9999);
-    newLFF.Arguments.emplace_back(newValue ? newValue : "",
-                                  cmListFileArgument::Quoted, 9999);
-    newLFF.Arguments.emplace_back(currentListFile, cmListFileArgument::Quoted,
-                                  9999);
-    newLFF.Arguments.emplace_back(stack, cmListFileArgument::Quoted, 9999);
+    cmListFileFunction newLFF;
+    const char* const currentListFile =
+      mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
+    const auto fakeLineNo =
+      std::numeric_limits<decltype(cmListFileArgument::Line)>::max();
+    newLFF.Arguments = {
+      { variable, cmListFileArgument::Quoted, fakeLineNo },
+      { accessString, cmListFileArgument::Quoted, fakeLineNo },
+      { newValue ? newValue : "", cmListFileArgument::Quoted, fakeLineNo },
+      { currentListFile, cmListFileArgument::Quoted, fakeLineNo },
+      { stack, cmListFileArgument::Quoted, fakeLineNo }
+    };
     newLFF.Name = data->Command;
-    newLFF.Line = 9999;
+    newLFF.Line = fakeLineNo;
     cmExecutionStatus status(*makefile);
     if (!makefile->ExecuteCommand(newLFF, status)) {
       cmSystemTools::Error(
         cmStrCat("Error in cmake code at\nUnknown:0:\nA command failed "
                  "during the invocation of callback \"",
                  data->Command, "\"."));
-      data->InCallback = false;
-      return;
     }
-    processed = true;
-  }
-  if (!processed) {
+  } else {
     makefile->IssueMessage(
       MessageType::LOG,
       cmStrCat("Variable \"", variable, "\" was accessed using ", accessString,
@@ -77,7 +73,7 @@ static void cmVariableWatchCommandVariableAccessed(const 
std::string& variable,
   data->InCallback = false;
 }
 
-static void deleteVariableWatchCallbackData(void* client_data)
+void deleteVariableWatchCallbackData(void* client_data)
 {
   cmVariableWatchCallbackData* data =
     static_cast<cmVariableWatchCallbackData*>(client_data);
@@ -91,7 +87,7 @@ class FinalAction
 public:
   /* NOLINTNEXTLINE(performance-unnecessary-value-param) */
   FinalAction(cmMakefile* makefile, std::string variable)
-    : Action(std::make_shared<Impl>(makefile, std::move(variable)))
+    : Action{ std::make_shared<Impl>(makefile, std::move(variable)) }
   {
   }
 
@@ -101,8 +97,8 @@ private:
   struct Impl
   {
     Impl(cmMakefile* makefile, std::string variable)
-      : Makefile(makefile)
-      , Variable(std::move(variable))
+      : Makefile{ makefile }
+      , Variable{ std::move(variable) }
     {
     }
 
@@ -112,12 +108,13 @@ private:
         this->Variable, cmVariableWatchCommandVariableAccessed);
     }
 
-    cmMakefile* Makefile;
-    std::string Variable;
+    cmMakefile* const Makefile;
+    std::string const Variable;
   };
 
   std::shared_ptr<Impl const> Action;
 };
+} // anonymous namespace
 
 bool cmVariableWatchCommand(std::vector<std::string> const& args,
                             cmExecutionStatus& status)
@@ -136,10 +133,10 @@ bool cmVariableWatchCommand(std::vector<std::string> 
const& args,
     return false;
   }
 
-  cmVariableWatchCallbackData* data = new cmVariableWatchCallbackData;
+  auto* const data = new cmVariableWatchCallbackData;
 
   data->InCallback = false;
-  data->Command = command;
+  data->Command = std::move(command);
 
   if (!status.GetMakefile().GetCMakeInstance()->GetVariableWatch()->AddWatch(
         variable, cmVariableWatchCommandVariableAccessed, data,
@@ -149,6 +146,6 @@ bool cmVariableWatchCommand(std::vector<std::string> const& 
args,
   }
 
   status.GetMakefile().AddFinalAction(
-    FinalAction(&status.GetMakefile(), variable));
+    FinalAction{ &status.GetMakefile(), variable });
   return true;
 }
diff --git 
a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt
index 4dddc96c8c..07deee2eaf 100644
--- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt
@@ -1,6 +1,6 @@
 [0-9]+
-CMake Error at .*/variable_watch\.cmake:9999 \(update_x\):
+CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of [0-9]+ exceeded
 Call Stack \(most recent call first\):
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt
index a8b4756da1..b2395b30f3 100644
--- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt
@@ -1,6 +1,6 @@
 [0-9]+
-CMake Error at variable_watch\.cmake:9999 \(update_x\):
+CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of [0-9]+ exceeded
 Call Stack \(most recent call first\):
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
diff --git 
a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt
index 4dddc96c8c..07deee2eaf 100644
--- 
a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt
+++ 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt
@@ -1,6 +1,6 @@
 [0-9]+
-CMake Error at .*/variable_watch\.cmake:9999 \(update_x\):
+CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of [0-9]+ exceeded
 Call Stack \(most recent call first\):
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
diff --git 
a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt
index a8b4756da1..b2395b30f3 100644
--- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt
@@ -1,6 +1,6 @@
 [0-9]+
-CMake Error at variable_watch\.cmake:9999 \(update_x\):
+CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of [0-9]+ exceeded
 Call Stack \(most recent call first\):
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
diff --git 
a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt
index 00b2b3c111..52fedd314c 100644
--- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt
@@ -2,17 +2,17 @@
 6
 8
 10
-CMake Error at .*/variable_watch\.cmake:9999 \(update_x\):
+CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of 10 exceeded
 Call Stack \(most recent call first\):
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
   .*/variable_watch\.cmake:5 \(set\)
-  .*/variable_watch\.cmake:9999 \(update_x\)
+  .*/variable_watch\.cmake:[0-9]+ \(update_x\)
   .*/variable_watch\.cmake:9 \(set\)
   .*/CMakeLists\.txt:5 \(include\)
 
diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt 
b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt
index 8f27bf1c29..1427f1df99 100644
--- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt
+++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt
@@ -2,17 +2,17 @@
 6
 8
 10
-CMake Error at variable_watch\.cmake:9999 \(update_x\):
+CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\):
   Maximum recursion depth of 10 exceeded
 Call Stack \(most recent call first\):
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
   variable_watch\.cmake:5 \(set\)
-  variable_watch\.cmake:9999 \(update_x\)
+  variable_watch\.cmake:[0-9]+ \(update_x\)
   variable_watch\.cmake:9 \(set\)
   CMakeLists\.txt:5 \(include\)
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=548e9051a4f20657d04341107924171ea9d1bcb5
commit 548e9051a4f20657d04341107924171ea9d1bcb5
Author:     Alexander Boczar <alex...@microsoft.com>
AuthorDate: Mon Sep 16 14:14:20 2019 -0700
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Oct 15 13:28:45 2019 -0400

    VS: Add support to override VCTargetsPath through toolset
    
    Fixes: #19708

diff --git a/Help/release/dev/vs-vctargetspath.rst 
b/Help/release/dev/vs-vctargetspath.rst
new file mode 100644
index 0000000000..ff9d148134
--- /dev/null
+++ b/Help/release/dev/vs-vctargetspath.rst
@@ -0,0 +1,6 @@
+vs-vctargetspath
+----------------
+
+* With :ref:`Visual Studio Generators` for VS 2010 and above,
+  the :variable:`CMAKE_GENERATOR_TOOLSET` setting gained an option
+  to specify the ``VCTargetsPath`` value for project files.
diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst 
b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
index 222824f6a9..53ad2f3e76 100644
--- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
+++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
@@ -58,3 +58,8 @@ Supported pairs are:
   Specify the toolset version to use.  Supported by VS 2017
   and above with the specified toolset installed.
   See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_VERSION` variable.
+
+``VCTargetsPath=<path>``
+  Specify an alternative ``VCTargetsPath`` value for Visual Studio
+  project files.  This allows use of VS platform extension configuration
+  files (``.props`` and ``.targets``) that are not installed with VS.
diff --git a/Modules/CMakeDetermineCompilerId.cmake 
b/Modules/CMakeDetermineCompilerId.cmake
index 908e530bd3..976b291220 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -317,6 +317,9 @@ Id flags: ${testflags} 
${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
     if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
       set(id_WindowsTargetPlatformVersion 
"<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>")
     endif()
+    if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR)
+      set(id_ToolsetVCTargetsDir 
"<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>")
+    endif()
     if(id_platform STREQUAL ARM64)
       set(id_WindowsSDKDesktopARMSupport 
"<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>")
     elseif(id_platform STREQUAL ARM)
diff --git a/Modules/CompilerId/VS-10.vcxproj.in 
b/Modules/CompilerId/VS-10.vcxproj.in
index d742274c4c..a3814dc0e5 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -15,6 +15,7 @@
     @id_WindowsTargetPlatformVersion@
     @id_WindowsSDKDesktopARMSupport@
     @id_CudaToolkitCustomDir@
+    @id_ToolsetVCTargetsDir@
   </PropertyGroup>
   @id_toolset_version_props@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx 
b/Source/cmGlobalVisualStudio10Generator.cxx
index 63915c50b5..5b83e2fe99 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -26,6 +26,16 @@
 static const char vs10generatorName[] = "Visual Studio 10 2010";
 static std::map<std::string, std::vector<cmIDEFlagTable>> loadedFlagJsonFiles;
 
+static void ConvertToWindowsSlashes(std::string& s)
+{
+  // first convert all of the slashes
+  for (auto& ch : s) {
+    if (ch == '/') {
+      ch = '\\';
+    }
+  }
+}
+
 // Map generator name without year to name with year.
 static const char* cmVS10GenName(const std::string& name, std::string& genName)
 {
@@ -212,7 +222,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
     return true;
   }
 
-  if (!this->FindVCTargetsPath(mf)) {
+  if (this->CustomVCTargetsPath.empty() && !this->FindVCTargetsPath(mf)) {
     return false;
   }
 
@@ -353,6 +363,11 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
   if (const char* cudaDir = this->GetPlatformToolsetCudaCustomDir()) {
     mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR", cudaDir);
   }
+  if (const char* vcTargetsDir = this->GetCustomVCTargetsPath()) {
+    mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR",
+                      vcTargetsDir);
+  }
+
   return true;
 }
 
@@ -446,6 +461,11 @@ bool 
cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField(
     this->GeneratorToolsetVersion = value;
     return true;
   }
+  if (key == "VCTargetsPath") {
+    this->CustomVCTargetsPath = value;
+    ConvertToWindowsSlashes(this->CustomVCTargetsPath);
+    return true;
+  }
   return false;
 }
 
@@ -607,6 +627,14 @@ void cmGlobalVisualStudio10Generator::EnableLanguage(
   cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
 }
 
+const char* cmGlobalVisualStudio10Generator::GetCustomVCTargetsPath() const
+{
+  if (this->CustomVCTargetsPath.empty()) {
+    return nullptr;
+  }
+  return this->CustomVCTargetsPath.c_str();
+}
+
 const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
 {
   std::string const& toolset = this->GetPlatformToolsetString();
diff --git a/Source/cmGlobalVisualStudio10Generator.h 
b/Source/cmGlobalVisualStudio10Generator.h
index e0968ab7ef..8a760476d0 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -46,6 +46,9 @@ public:
   bool IsNsightTegra() const;
   std::string GetNsightTegraVersion() const;
 
+  /** The vctargets path for the target platform.  */
+  const char* GetCustomVCTargetsPath() const;
+
   /** The toolset name for the target platform.  */
   const char* GetPlatformToolset() const;
   std::string const& GetPlatformToolsetString() const;
@@ -156,6 +159,7 @@ protected:
   std::string GeneratorToolset;
   std::string GeneratorToolsetVersion;
   std::string GeneratorToolsetHostArchitecture;
+  std::string GeneratorToolsetCustomVCTargetsDir;
   std::string GeneratorToolsetCuda;
   std::string GeneratorToolsetCudaCustomDir;
   std::string DefaultPlatformToolset;
@@ -207,6 +211,7 @@ private:
 
   bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
 
+  std::string CustomVCTargetsPath;
   std::string VCTargetsPath;
   bool FindVCTargetsPath(cmMakefile* mf);
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index 3843bf24c4..40a0e067aa 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -543,6 +543,11 @@ void cmVisualStudio10TargetGenerator::Generate()
         e1.Element("VCProjectUpgraderObjectName", "NoUpgrade");
       }
 
+      if (const char* vcTargetsPath =
+            this->GlobalGenerator->GetCustomVCTargetsPath()) {
+        e1.Element("VCTargetsPath", vcTargetsPath);
+      }
+
       std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys();
       for (std::string const& keyIt : keys) {
         static const char* prefix = "VS_GLOBAL_";
diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake 
b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
index ae75561b11..bb22841543 100644
--- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
@@ -30,6 +30,8 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]")
     set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x86")
     run_cmake(BadToolsetHostArchTwice)
     if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[56]")
+      set(RunCMake_GENERATOR_TOOLSET "VCTargetsPath=Test Path")
+      run_cmake(TestToolsetVCTargetsPathOnly)
       set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset 
Version")
       run_cmake(TestToolsetVersionBoth)
       set(RunCMake_GENERATOR_TOOLSET ",version=Test Toolset Version")
diff --git 
a/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt 
b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt
new file mode 100644
index 0000000000..c46373f2e3
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt
@@ -0,0 +1,2 @@
+-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+'
+-- CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR='Test Path'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake 
b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake
new file mode 100644
index 0000000000..c20a303b6a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake
@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
+message(STATUS 
"CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR='${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}'")
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake 
b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 44ccd6b585..32b68295e4 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -28,6 +28,10 @@ run_cmake(VsDpiAwareBadParam)
 run_cmake(VsPrecompileHeaders)
 run_cmake(VsPrecompileHeadersReuseFromCompilePDBName)
 
+set(RunCMake_GENERATOR_TOOLSET "VCTargetsPath=$(VCTargetsPath)")
+run_cmake(VsVCTargetsPath)
+unset(RunCMake_GENERATOR_TOOLSET)
+
 if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION 
VERSION_GREATER_EQUAL 19.05)
   run_cmake(VsJustMyCode)
 endif()
diff --git a/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake 
b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake
new file mode 100644
index 0000000000..5b1701c85c
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake
@@ -0,0 +1,32 @@
+macro(check_project_file projectFile)
+  set(insideGlobals FALSE)
+  set(pathFound FALSE)
+
+  if(NOT EXISTS "${projectFile}")
+    set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.")
+    return()
+  endif()
+
+  string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile})
+
+  file(STRINGS "${projectFile}" lines)
+  foreach(line IN LISTS lines)
+    if(line MATCHES "^ *<PropertyGroup Label=\"Globals\">.*$")
+      set(insideGlobals TRUE)
+    elseif(insideGlobals)
+      if(line MATCHES "^ *</PropertyGroup>.*$")
+        set(insideGlobals FALSE)
+      elseif(line MATCHES "^ *<VCTargetsPath>(.+)</VCTargetsPath>*$")
+        message(STATUS "Found VCTargetsPath = ${CMAKE_MATCH_1} in 
PropertyGroup 'Globals' in ${projectName}")
+        set(pathFound TRUE)
+      endif()
+    endif()
+  endforeach()
+  if(NOT pathFound)
+    set(RunCMake_TEST_FAILED "VCTargetsPath not found in \"Globals\" 
propertygroup in ${projectName}")
+    return() # This should intentionally return from the caller, not the macro
+  endif()
+endmacro()
+
+check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj")
+check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
diff --git a/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake 
b/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake
new file mode 100644
index 0000000000..6a6088f9e3
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake
@@ -0,0 +1,3 @@
+enable_language(CXX)
+
+add_library(foo foo.cpp)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99e83d423500e11a8e85c2032e8c536bce175ed1
commit 99e83d423500e11a8e85c2032e8c536bce175ed1
Author:     Alexander Boczar <alex...@microsoft.com>
AuthorDate: Fri Sep 13 17:32:13 2019 -0700
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Oct 15 13:28:41 2019 -0400

    cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
    
    Extend the `cmGlobalGenerator::SetGeneratorToolset` signature to
    indicate when it is called from `cmake::build`.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 96656a5997..2efafc64ba 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -165,7 +165,7 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string 
const& p,
   return false;
 }
 
-bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
+bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, bool,
                                             cmMakefile* mf)
 {
   if (ts.empty()) {
@@ -650,7 +650,7 @@ void cmGlobalGenerator::EnableLanguage(
 
     // Tell the generator about the toolset, if any.
     std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET");
-    if (!this->SetGeneratorToolset(toolset, mf)) {
+    if (!this->SetGeneratorToolset(toolset, false, mf)) {
       cmSystemTools::SetFatalErrorOccured();
       return;
     }
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index f25ff7b77e..0e8735775e 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -128,7 +128,8 @@ public:
 
   /** Set the generator-specific toolset name.  Returns true if toolset
       is supported and false otherwise.  */
-  virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
+  virtual bool SetGeneratorToolset(std::string const& ts, bool build,
+                                   cmMakefile* mf);
 
   /**
    * Create LocalGenerators and process the CMakeLists files. This does not
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx 
b/Source/cmGlobalGhsMultiGenerator.cxx
index 5a708abbcb..7afcd496e7 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -64,8 +64,11 @@ void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory(
 }
 
 bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
-                                                    cmMakefile* mf)
+                                                    bool build, cmMakefile* mf)
 {
+  if (build) {
+    return true;
+  }
   std::string tsp; /* toolset path */
 
   this->GetToolset(mf, tsp, ts);
diff --git a/Source/cmGlobalGhsMultiGenerator.h 
b/Source/cmGlobalGhsMultiGenerator.h
index ccfe073820..7cd8c794ce 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -58,7 +58,8 @@ public:
   static bool SupportsPlatform() { return true; }
 
   // Toolset / Platform Support
-  bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
+  bool SetGeneratorToolset(std::string const& ts, bool build,
+                           cmMakefile* mf) override;
   bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override;
 
   /**
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx 
b/Source/cmGlobalVisualStudio10Generator.cxx
index 09a49e1e9d..63915c50b5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -193,7 +193,7 @@ static void cmCudaToolVersion(std::string& s)
 }
 
 bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
-  std::string const& ts, cmMakefile* mf)
+  std::string const& ts, bool build, cmMakefile* mf)
 {
   if (this->SystemIsWindowsCE && ts.empty() &&
       this->DefaultPlatformToolset.empty()) {
@@ -208,6 +208,10 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
     return false;
   }
 
+  if (build) {
+    return true;
+  }
+
   if (!this->FindVCTargetsPath(mf)) {
     return false;
   }
diff --git a/Source/cmGlobalVisualStudio10Generator.h 
b/Source/cmGlobalVisualStudio10Generator.h
index 9adcf08ae2..e0968ab7ef 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -20,7 +20,8 @@ public:
 
   bool SetSystemName(std::string const& s, cmMakefile* mf) override;
   bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override;
-  bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
+  bool SetGeneratorToolset(std::string const& ts, bool build,
+                           cmMakefile* mf) override;
 
   std::vector<GeneratedMakeCommand> GenerateBuildCommand(
     const std::string& makeProgram, const std::string& projectName,
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index 67f1a46103..8a731cf37d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -267,7 +267,7 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
 }
 
 bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
-                                                 cmMakefile* mf)
+                                                 bool build, cmMakefile* mf)
 {
   if (ts.find_first_of(",=") != std::string::npos) {
     std::ostringstream e;
@@ -283,6 +283,9 @@ bool 
cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
     return false;
   }
   this->GeneratorToolset = ts;
+  if (build) {
+    return true;
+  }
   if (!this->GeneratorToolset.empty()) {
     mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", this->GeneratorToolset);
   }
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index af905d00c4..f60ea728d8 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -103,7 +103,8 @@ public:
 
   bool ShouldStripResourcePath(cmMakefile*) const override;
 
-  bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
+  bool SetGeneratorToolset(std::string const& ts, bool build,
+                           cmMakefile* mf) override;
   void AppendFlag(std::string& flags, std::string const& flag) const;
 
 protected:
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index bbd33a75bc..47cc59d739 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2620,6 +2620,14 @@ int cmake::Build(int jobs, const std::string& dir,
       return 1;
     }
   }
+  const char* cachedGeneratorToolset =
+    this->State->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
+  if (cachedGeneratorToolset) {
+    cmMakefile mf(gen, this->GetCurrentSnapshot());
+    if (!gen->SetGeneratorToolset(cachedGeneratorToolset, true, &mf)) {
+      return 1;
+    }
+  }
   std::string output;
   std::string projName;
   const char* cachedProjectName =

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/vs-vctargetspath.rst              | 10 +++
 Help/variable/CMAKE_GENERATOR_TOOLSET.rst          |  5 ++
 Modules/CMakeDetermineCompilerId.cmake             |  9 +++
 Modules/CompilerId/VS-10.vcxproj.in                |  2 +
 Source/cmGlobalGenerator.cxx                       |  4 +-
 Source/cmGlobalGenerator.h                         |  3 +-
 Source/cmGlobalGhsMultiGenerator.cxx               |  5 +-
 Source/cmGlobalGhsMultiGenerator.h                 |  3 +-
 Source/cmGlobalVisualStudio10Generator.cxx         | 36 ++++++++-
 Source/cmGlobalVisualStudio10Generator.h           |  8 +-
 Source/cmGlobalXCodeGenerator.cxx                  |  5 +-
 Source/cmGlobalXCodeGenerator.h                    |  3 +-
 Source/cmTarget.cxx                                |  3 +-
 Source/cmVariableWatch.cxx                         | 14 ++--
 Source/cmVariableWatch.h                           |  4 +-
 Source/cmVariableWatchCommand.cxx                  | 65 ++++++++-------
 Source/cmVisualStudio10TargetGenerator.cxx         |  5 ++
 Source/cmake.cxx                                   |  8 ++
 Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake |  2 +
 .../TestToolsetVCTargetsPathOnly-stdout.txt        |  2 +
 .../TestToolsetVCTargetsPathOnly.cmake             |  2 +
 .../variable_watch-default-script-stderr.txt       |  4 +-
 .../variable_watch-default-stderr.txt              |  4 +-
 .../variable_watch-invalid-var-script-stderr.txt   |  4 +-
 .../variable_watch-invalid-var-stderr.txt          |  4 +-
 .../variable_watch-var-script-stderr.txt           | 10 +--
 .../variable_watch-var-stderr.txt                  | 10 +--
 Tests/RunCMake/VS10Project/RunCMakeTest.cmake      |  4 +
 Tests/RunCMake/VS10Project/VsGlobals-check.cmake   | 93 +++++++++++++---------
 Tests/RunCMake/VS10Project/VsGlobals.cmake         |  7 +-
 .../VS10Project/VsVCTargetsPath-check.cmake        | 32 ++++++++
 Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake   |  3 +
 32 files changed, 261 insertions(+), 112 deletions(-)
 create mode 100644 Help/release/dev/vs-vctargetspath.rst
 create mode 100644 
Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt
 create mode 100644 
Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake
 create mode 100644 Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake
 create mode 100644 Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to