summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-27 11:50:36 -0400
committerBrad King <brad.king@kitware.com>2017-03-27 11:50:36 -0400
commit3ed87b7ee1038f11e7d86988aca692c0773209b6 (patch)
treede2b8ac4bee5f441511c6416c0314f02190ae082
parent16cd8600683a0e144f31a2e2551013283458f231 (diff)
parent6eb609fd59d989fede93fadfc67b928ee7ab7fc2 (diff)
downloadcmake-3ed87b7ee1038f11e7d86988aca692c0773209b6.tar.gz
Merge branch 'InstallRequiredSystemLibraries-vs2017' into release
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake26
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx13
2 files changed, 32 insertions, 7 deletions
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 1061da0b05..a3478a387f 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -191,19 +191,31 @@ if(MSVC)
set(vs "${_MSVCRT_IDE_VERSION}")
# Find the runtime library redistribution directory.
- get_filename_component(msvc_install_dir
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
- set(programfilesx86 "ProgramFiles(x86)")
if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
endif()
- find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT
- PATHS
- "${msvc_install_dir}/../../VC/redist"
+ if(NOT vs VERSION_LESS 15)
+ set(_vs_redist_paths "")
+ cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) # undocumented query
+ if(IS_DIRECTORY "${_vs_dir}")
+ file(GLOB _vs_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
+ endif()
+ unset(_vs_dir)
+ else()
+ get_filename_component(_vs_dir
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
+ set(programfilesx86 "ProgramFiles(x86)")
+ set(_vs_redist_paths
+ "${_vs_dir}/../../VC/redist"
"${base_dir}/VC/redist"
"$ENV{ProgramFiles}/Microsoft Visual Studio ${vs}.0/VC/redist"
"$ENV{${programfilesx86}}/Microsoft Visual Studio ${vs}.0/VC/redist"
- )
+ )
+ unset(_vs_dir)
+ unset(programfilesx86)
+ endif()
+ find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT PATHS ${_vs_redist_paths})
+ unset(_vs_redist_paths)
mark_as_advanced(MSVC_REDIST_DIR)
set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT")
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 7da93ace85..e135ac690e 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -7,6 +7,12 @@
#include "cmMakefile.h"
#include "cmsys/SystemInformation.hxx"
+#if defined(_WIN32)
+#include "cmSystemTools.h"
+#include "cmVSSetupHelper.h"
+#define HAVE_VS_SETUP_HELPER
+#endif
+
class cmExecutionStatus;
// cmCMakeHostSystemInformation
@@ -70,6 +76,13 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
value = this->ValueToString(info.GetTotalPhysicalMemory());
} else if (key == "AVAILABLE_PHYSICAL_MEMORY") {
value = this->ValueToString(info.GetAvailablePhysicalMemory());
+#ifdef HAVE_VS_SETUP_HELPER
+ } else if (key == "VS_15_DIR") {
+ cmVSSetupAPIHelper vsSetupAPIHelper;
+ if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
+ cmSystemTools::ConvertToUnixSlashes(value);
+ }
+#endif
} else {
std::string e = "does not recognize <key> " + key;
this->SetError(e);