Skip to content

Commit 717e854

Browse files
committed
FindBoost: Add support for MSVC toolset version 14.2
Generalize the logic to express compatibility among 14.x versions.
1 parent db6fdfd commit 717e854

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

Modules/FindBoost.cmake

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,17 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
466466
elseif (GHSMULTI)
467467
set(_boost_COMPILER "-ghs")
468468
elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
469-
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
470-
set(_boost_COMPILER "-vc141;-vc140")
469+
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150)
470+
# Not yet known.
471+
set(_boost_COMPILER "")
472+
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140)
473+
# MSVC toolset 14.x versions are forward compatible.
474+
set(_boost_COMPILER "")
475+
foreach(v 9 8 7 6 5 4 3 2 1 0)
476+
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v})
477+
list(APPEND _boost_COMPILER "-vc14${v}")
478+
endif()
479+
endforeach()
471480
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
472481
set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
473482
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
@@ -1083,9 +1092,15 @@ function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS component
10831092
else()
10841093
set(_arch_suffix 32)
10851094
endif()
1086-
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
1087-
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
1088-
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
1095+
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150)
1096+
# Not yet known.
1097+
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140)
1098+
# MSVC toolset 14.x versions are forward compatible.
1099+
foreach(v 9 8 7 6 5 4 3 2 1 0)
1100+
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v})
1101+
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.${v})
1102+
endif()
1103+
endforeach()
10891104
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
10901105
math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
10911106
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0)

0 commit comments

Comments
 (0)