diff options
author | Brad King <brad.king@kitware.com> | 2017-03-28 14:14:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-03-28 14:14:59 (GMT) |
commit | 83199f8daf13328a4fb97c16476c3a0da4228ead (patch) | |
tree | 68bda02d87692a48e2c1989d118ba005d4701039 /Modules | |
parent | 4d970868489e7a7a45419ad74444afe2ab8239ee (diff) | |
parent | 6eb609fd59d989fede93fadfc67b928ee7ab7fc2 (diff) | |
download | CMake-83199f8daf13328a4fb97c16476c3a0da4228ead.zip CMake-83199f8daf13328a4fb97c16476c3a0da4228ead.tar.gz CMake-83199f8daf13328a4fb97c16476c3a0da4228ead.tar.bz2 |
Merge topic 'InstallRequiredSystemLibraries-vs2017'
6eb609fd InstallRequiredSystemLibraries: Find VS 2017 redist directory
cf784d9f Add undocumented CMake language means to find VS 2017
082c0375 InstallRequiredSystemLibraries: Split VS 2017 search paths
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !632
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/InstallRequiredSystemLibraries.cmake | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 1061da0..a3478a3 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") |