Skip to content

Commit 4cac01c

Browse files
committed
Merge branch 'InstallRequiredSystemLibraries-redist' into release-3.15
Merge-request: !3585
2 parents fc2a7c8 + 13c3ec5 commit 4cac01c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Modules/InstallRequiredSystemLibraries.cmake

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ if(MSVC)
210210
set(_MSVC_IDE_VERSION "")
211211
if(MSVC_VERSION GREATER_EQUAL 2000)
212212
message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
213-
elseif(MSVC_VERSION_VERSION GREATER_EQUAL 143)
214-
message(WARNING "MSVC toolset v${MSVC_VERSION_VERSION} not yet supported.")
213+
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 143)
214+
message(WARNING "MSVC toolset v${MSVC_TOOLSET_VERSION} not yet supported.")
215215
elseif(MSVC_TOOLSET_VERSION EQUAL 142)
216216
set(MSVC_REDIST_NAME VC142)
217217
set(_MSVC_DLL_VERSION 140)
@@ -251,10 +251,18 @@ if(MSVC)
251251
endif()
252252
if(NOT vs VERSION_LESS 15)
253253
set(_vs_redist_paths "")
254-
cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) # undocumented query
255-
if(IS_DIRECTORY "${_vs_dir}")
256-
file(GLOB _vs_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
257-
endif()
254+
# The toolset and its redistributables may come with any VS version 15 or newer.
255+
set(_MSVC_IDE_VERSIONS 16 15)
256+
foreach(_vs_ver ${_MSVC_IDE_VERSIONS})
257+
set(_vs_glob_redist_paths "")
258+
cmake_host_system_information(RESULT _vs_dir QUERY VS_${_vs_ver}_DIR) # undocumented query
259+
if(IS_DIRECTORY "${_vs_dir}")
260+
file(GLOB _vs_glob_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
261+
list(APPEND _vs_redist_paths ${_vs_glob_redist_paths})
262+
endif()
263+
unset(_vs_glob_redist_paths)
264+
endforeach()
265+
unset(_MSVC_IDE_VERSIONS)
258266
unset(_vs_dir)
259267
else()
260268
get_filename_component(_vs_dir

0 commit comments

Comments
 (0)