From 9d7d80158fba59ece9f3edff0145a479ded8a7b4 Mon Sep 17 00:00:00 2001 From: Edouard Griffiths Date: Sat, 5 Feb 2022 12:04:34 +0100 Subject: [PATCH 1/2] Allow VS2022 in MSVC build --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24a024be2..3c9adff01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,10 +201,12 @@ elseif (WIN32) set(VS2017 ON) elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910) set(VS2015 ON) + elseif(MSVC_VERSION GREATER 1930) + set(VS2022 ON) endif() - if(NOT VS2015 AND NOT VS2017 AND NOT VS2019) - message(FATAL_ERROR "You must use Microsoft Visual Studio 2015, 2017 or 2019 as compiler") + if(NOT VS2015 AND NOT VS2017 AND NOT VS2019 AND NOT VS2022) + message(FATAL_ERROR "You must use Microsoft Visual Studio 2015, 2017, 2019 or greater as compiler") endif() # in alternative we can use ExternalProject From fd1eecd00e658c5fb2ff697080dd6a31c5bba621 Mon Sep 17 00:00:00 2001 From: Edouard Griffiths Date: Sat, 5 Feb 2022 12:17:46 +0100 Subject: [PATCH 2/2] Allow VS2022 for MSVC (take 2) --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c9adff01..fe3934fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,14 +195,14 @@ elseif(APPLE) elseif (WIN32) # check compiler version message(STATUS "MSVC_VERSION is ${MSVC_VERSION}") - if(MSVC_VERSION GREATER 1920 AND MSVC_VERSION LESS 1930) - set(VS2019 ON) - elseif(MSVC_VERSION GREATER 1910 AND MSVC_VERSION LESS 1919) - set(VS2017 ON) - elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910) - set(VS2015 ON) - elseif(MSVC_VERSION GREATER 1930) + if(MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1940) set(VS2022 ON) + elseif(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930) + set(VS2019 ON) + elseif(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1919) + set(VS2017 ON) + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS 1910) + set(VS2015 ON) endif() if(NOT VS2015 AND NOT VS2017 AND NOT VS2019 AND NOT VS2022)