diff options
author | Brad King <brad.king@kitware.com> | 2017-03-27 11:40:47 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-27 11:43:01 -0400 |
commit | 082c0375d9f21ada36bdd8fd710720e553bcdbbb (patch) | |
tree | 68043d54eeba15ef7010e7b78440c20633819e93 /Modules | |
parent | d4a693a08385024175240a5543cc2a7bb7311966 (diff) | |
download | cmake-082c0375d9f21ada36bdd8fd710720e553bcdbbb.tar.gz |
InstallRequiredSystemLibraries: Split VS 2017 search paths
VS 2017 does not have the same registry entries or other paths we
search for other VS versions. Split the search code paths to treat
it separately.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/InstallRequiredSystemLibraries.cmake | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 1061da0b05..9750a065cf 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -191,19 +191,26 @@ 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 "") + 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") |