From c3e637abffbe60c12aa57df84fdef797b1cbc5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=BCthing?= <muething@dune-project.org> Date: Tue, 19 May 2015 14:30:40 +0200 Subject: [PATCH] [Release][CMake][Bugfix] Fail hard if we find nullptr, but not std::nullptr_t We do not really support this combination of C++11 features, and the only time it should occur is when the user has a recent Intel Compiler and an outdated GCC (which the Intel Compiler uses for the C++ standard library). In that case, we emit a helpful error message at configuration time. --- cmake/modules/CheckCXX11Features.cmake | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/cmake/modules/CheckCXX11Features.cmake b/cmake/modules/CheckCXX11Features.cmake index 5a3a7b852..bf75b18f0 100644 --- a/cmake/modules/CheckCXX11Features.cmake +++ b/cmake/modules/CheckCXX11Features.cmake @@ -60,7 +60,33 @@ check_cxx_source_compiles(" return 0; } " HAVE_NULLPTR -) + ) + +if(HAVE_NULLPTR) + check_cxx_source_compiles(" + #include <cstddef> + + int main(void) + { + std::nullptr_t npt = nullptr; + return 0; + } +" HAVE_NULLPTR_T + ) + if (NOT HAVE_NULLPTR_T) + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") + message(FATAL_ERROR "Your compiler supports the 'nullptr' keyword, but not the type std::nullptr_t. +You are using an Intel compiler, where this error is typically caused by an outdated underlying system GCC. +Check if 'gcc --version' gives you at least GCC 4.6, otherwise please install a newer GCC and point your Intel compiler at it using the '-gcc-name' or '-gxx-name' options (see 'man icc' for further details)." + ) + else() + message(FATAL_ERROR "Your compiler supports the 'nullptr' keyword, but not the type std::nullptr_t. +THIS SHOULD NOT HAPPEN FOR YOUR COMPILER! +Please submit a bug at https://dune-project.org/flyspray/" + ) + endif() + endif() +endif() # __attribute__((unused)) check_cxx_source_compiles(" -- GitLab