diff --git a/CMakeLists.txt b/CMakeLists.txt index 918d9464..c8743252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,7 +141,6 @@ install (FILES ################# compile tests ################ -#include_directories("${CMAKE_CURRENT_BINARY_DIR}/lib/googletest/include;${CMAKE_CURRENT_BINARY_DIR}/src/include") ADD_SUBDIRECTORY( lib/googletest ) ADD_SUBDIRECTORY( tests ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ed7b4a7a..46f2cc8a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,15 +4,22 @@ include(CheckCXXCompilerFlag) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/googletest/include) +CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has C++14 support.") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +elseif(COMPILER_SUPPORTS_CXX11) + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has C++11 support.") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has C++0x support.") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++0x, C++11 or C++14 support. FANN will still work with no problem, but the tests will not be able to compile.") + return() endif() ADD_EXECUTABLE(fann_tests main.cpp fann_test.cpp fann_test_data.cpp fann_test_train.cpp) -target_link_libraries(fann_tests gtest doublefann) \ No newline at end of file +target_link_libraries(fann_tests gtest doublefann)