1
0
Fork 0

Hard minimum compiler version GCC 4.8 and Clang 3.4 (#3587)

Fixes #3155.
This commit is contained in:
johnsoch 2017-03-10 01:45:11 -06:00 committed by Mattes D
parent d0b956d8c4
commit 9fa8477b73
1 changed files with 12 additions and 0 deletions

View File

@ -106,6 +106,18 @@ if(MSVC OR MSVC_IDE)
set(CMAKE_GENERATOR_TOOLSET "v120_CTP_Nov2012" CACHE STRING "Platform Toolset" FORCE)
else() # VC12+, assuming C++11 supported.
endif()
else() # GCC or Clang, so get compiler version directly since CMAKE_CXX_COMPILER_VERSION is only available in CMake 2.8.8 and later
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE DUMPED_COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
# Check for gcc version 4.8 or greater
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND DUMPED_COMPILER_VERSION VERSION_LESS "4.8")
message(FATAL_ERROR "You have ${CMAKE_CXX_COMPILER_ID} version ${DUMPED_COMPILER_VERSION}, but at least 4.8 is needed")
endif()
# Check for clang version 3.4 or greater
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND DUMPED_COMPILER_VERSION VERSION_LESS "3.4")
message(FATAL_ERROR "You have ${CMAKE_CXX_COMPILER_ID} version ${DUMPED_COMPILER_VERSION}, but at least 3.4 is needed")
endif()
endif()
set(BUILD_TOOLS OFF CACHE BOOL "")