Skip to content

Commit 13c3ec5

Browse files
jamesobutlerbradking
authored andcommitted
IRSL: Fix discovery of VS 2019 v141 toolset redistributables
Since VS 2019, the v141 toolset redistributables can be found in either the VS 2019 or VS 2017 install directory. Update the logic to search multiple versions of VS. Fixes: #19488
1 parent 0484165 commit 13c3ec5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Modules/InstallRequiredSystemLibraries.cmake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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)