@@ -210,8 +210,8 @@ if(MSVC)
210
210
set (_MSVC_IDE_VERSION "" )
211
211
if (MSVC_VERSION GREATER_EQUAL 2000)
212
212
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." )
215
215
elseif (MSVC_TOOLSET_VERSION EQUAL 142)
216
216
set (MSVC_REDIST_NAME VC142)
217
217
set (_MSVC_DLL_VERSION 140)
@@ -251,10 +251,18 @@ if(MSVC)
251
251
endif ()
252
252
if (NOT vs VERSION_LESS 15)
253
253
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)
258
266
unset (_vs_dir)
259
267
else ()
260
268
get_filename_component (_vs_dir
0 commit comments