]> OCCT Git - occt.git/commitdiff
Configuration - Message about compiler limitation #311
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Fri, 31 Jan 2025 23:04:01 +0000 (00:04 +0100)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2025 23:04:01 +0000 (23:04 +0000)
Build System - Add compiler version checks for C++17 support

adm/cmake/occt_macros.cmake

index 7ec52b89d2daf28620bdfc1c63b1a6443e11bc12..d6bc06ee90e9d15c3074ab2812f5ea638130e1ac 100644 (file)
@@ -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()