From ab1b983fe3e15b9af0d885da72c8f5f32934c751 Mon Sep 17 00:00:00 2001 From: Joel Self Date: Tue, 6 Sep 2016 09:52:55 -0600 Subject: [PATCH] Added a check for C++11 support. If not supported a warning is printed and tests are not compiled. --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b3b82cf..1b11d762 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,13 @@ endif () project (FANN) +INCLUDE(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11) + +IF(NOT COMPILER_SUPPORTS_CXX11) + message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Tests will not be compiled. To enable tests use a compiler that supports C++11.") +ENDIF() + list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) set (FANN_VERSION_MAJOR 2) @@ -142,6 +149,9 @@ install (FILES ################# compile tests ################ ADD_SUBDIRECTORY( lib/googletest ) -ADD_SUBDIRECTORY( tests ) + +if(COMPILER_SUPPORTS_CXX11) + ADD_SUBDIRECTORY( tests ) +endif() ENDIF()