From 2027acc3de1bf4356ee9c69bdb2ae1a48d84da37 Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Sat, 1 Feb 2025 00:04:01 +0100 Subject: [PATCH] Configuration - Message about compiler limitation #311 Build System - Add compiler version checks for C++17 support --- adm/cmake/occt_macros.cmake | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake index 7ec52b89d2..d6bc06ee90 100644 --- a/adm/cmake/occt_macros.cmake +++ b/adm/cmake/occt_macros.cmake @@ -75,6 +75,10 @@ endmacro() # COMPILER variable macro (OCCT_MAKE_COMPILER_SHORT_NAME) if (MSVC) + if (MSVC_VERSION LESS 1914) + message (AUTHOR_WARNING "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support") + endif() + if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310)) set (COMPILER vc7) elseif (MSVC_VERSION EQUAL 1400) @@ -92,20 +96,39 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME) elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000)) # Since Visual Studio 15 (2017), its version diverged from version of # compiler which is 14.1; as that compiler uses the same run-time as 14.0, - # we keep its id as "vc14" to be compatibille + # we keep its id as "vc14" to be compatible set (COMPILER vc14) else() message (FATAL_ERROR "Unrecognized MSVC_VERSION") endif() elseif (DEFINED CMAKE_COMPILER_IS_GNUCC) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support") + endif() set (COMPILER gcc) elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support") + endif() set (COMPILER gxx) elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]") + if(APPLE) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0) + message (AUTHOR_WARNING "Apple Clang version 11.0.0 or newer is required for C++17 support") + endif() + else() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + message (AUTHOR_WARNING "Clang version 7.0 or newer is required for C++17 support") + endif() + endif() set (COMPILER clang) elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.1.1) + message (AUTHOR_WARNING "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support") + endif() set (COMPILER icc) else() + message (AUTHOR_WARNING "Unknown compiler - please verify C++17 support") set (COMPILER ${CMAKE_GENERATOR}) string (REGEX REPLACE " " "" COMPILER ${COMPILER}) endif()