Browse Source

Merge topic 'vs-v142-version'

5117389931 VS: Fix support for v142 toolset minor versions

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3874
Brad King 6 years ago
parent
commit
20e9151e6c

+ 7 - 1
Modules/CMakeDetermineCompilerId.cmake

@@ -284,7 +284,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
           set(id_cl icl.exe)
         endif()
         if(CMAKE_VS_PLATFORM_TOOLSET_VERSION)
-          set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build\\${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />")
+          if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20")
+            set(id_sep ".")
+          else()
+            set(id_sep "\\")
+          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)
         endif()
       endif()
     else()

+ 3 - 1
Source/cmGlobalVisualStudioVersionedGenerator.cxx

@@ -390,7 +390,9 @@ std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
     GetVSInstance(instancePath);
     std::stringstream path;
     path << instancePath;
-    path << "/VC/Auxiliary/Build/";
+    path << "/VC/Auxiliary/Build";
+    path << (cmSystemTools::VersionCompareGreaterEq(version, "14.20") ? '.'
+                                                                      : '/');
     path << version;
     path << "/Microsoft.VCToolsVersion." << version << ".props";