From e9d88d317345b8764a6e8e526b941a9f02dedb2a Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Thu, 22 Dec 2016 00:40:45 +0100 Subject: [PATCH] fix(cmake): Check compiler version --- cmake/build/core.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/build/core.cmake b/cmake/build/core.cmake index 0c442477..ae419f2b 100644 --- a/cmake/build/core.cmake +++ b/cmake/build/core.cmake @@ -32,11 +32,19 @@ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s") # Check compiler if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) - message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}" 32) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0") + message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31) + else() + message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32) + endif() elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) - message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}" 32) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1.0") + message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31) + else() + message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32) + endif() else() - message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID} !" 31) + message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION} !" 31) endif() # Set compiler and linker flags for preferred C++ library