diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 32c583b911b79cf7b9661054009ef4f35e80e178..107d2c9e51d86d25f0f86096be98bcfc71f105ac 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -16,6 +16,18 @@ if (CMAKE_C_COMPILER_ID STREQUAL Clang) set(CMAKE_COMPILER_IS_GNUCXX OFF) endif() +# +# Hard coding the compiler version is ugly from cmake POV, but +# at least gives user a friendly error message. The most critical +# demand for C++ compiler is support of C++11 lambdas, added +# only in version 4.5 https://gcc.gnu.org/projects/cxx0x.html +# +if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5) + message(FATAL_ERROR " + Your GCC version is ${CMAKE_CXX_COMPILER_VERSION}, please update to version 4.6 or later + ") +endif() + # # Check supported standards #