summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-13 15:31:32 +0000
committerKitware Robot <kwrobot@kitware.com>2019-12-13 10:31:41 -0500
commitc55b4b4b24dcb8ff1234a4386112fed467f1c3f5 (patch)
tree7fe4ba1b31f6016a8c90e952bad26c1d134be38e
parent4771c4e447c88a0e6a361d98c2c6f44ac7746ad3 (diff)
parent2f853eec3dc7efa9521f9df6ef03bedd6492234b (diff)
downloadcmake-c55b4b4b24dcb8ff1234a4386112fed467f1c3f5.tar.gz
Merge topic 'backport-3.16-vs-v142-version' into release-3.16
2f853eec3d Merge branch 'backport-3.15-vs-v142-version' into backport-3.16-vs-v142-version d8d4924d98 VS: Fix support for v142 toolset minor versions in VS 16.5+ 07612646fe VS: Fix support for v142 toolset minor versions in VS 16.5+ Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4133
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake7
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx23
2 files changed, 18 insertions, 12 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 908e530bd3..7b571c3c87 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -284,10 +284,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_cl icl.exe)
endif()
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION)
+ set(id_sep "\\")
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20")
- set(id_sep ".")
- else()
- set(id_sep "\\")
+ if(EXISTS "${CMAKE_GENERATOR_INSTANCE}/VC/Auxiliary/Build.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}/Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props")
+ set(id_sep ".")
+ endif()
endif()
set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build${id_sep}${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />")
unset(id_sep)
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 1eca1f6003..a371633ed0 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -6,6 +6,7 @@
#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmVSSetupHelper.h"
#include "cmake.h"
@@ -388,15 +389,19 @@ std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
if (version) {
std::string instancePath;
GetVSInstance(instancePath);
- std::stringstream path;
- path << instancePath;
- path << "/VC/Auxiliary/Build";
- path << (cmSystemTools::VersionCompareGreaterEq(version, "14.20") ? '.'
- : '/');
- path << version;
- path << "/Microsoft.VCToolsVersion." << version << ".props";
-
- std::string toolsetPath = path.str();
+ std::string toolsetDir = instancePath + "/VC/Auxiliary/Build";
+ char sep = '/';
+ if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) {
+ std::string toolsetDot =
+ cmStrCat(toolsetDir, '.', version, "/Microsoft.VCToolsVersion.",
+ version, ".props");
+ if (cmSystemTools::PathExists(toolsetDot)) {
+ sep = '.';
+ }
+ }
+ std::string toolsetPath =
+ cmStrCat(toolsetDir, sep, version, "/Microsoft.VCToolsVersion.", version,
+ ".props");
cmSystemTools::ConvertToUnixSlashes(toolsetPath);
return toolsetPath;
}