Commit 2d82c8e5 authored by Simon Liu's avatar Simon Liu Committed by Sasha Goldshtein

used the CheckCXXCompilerFlag module of Cmake to check the compiler whether or...

used the CheckCXXCompilerFlag module of Cmake to check the compiler whether or not supporting c++11. (#1116)
parent 5c080419
......@@ -10,6 +10,7 @@ enable_testing()
include(cmake/GetGitRevisionDescription.cmake)
include(cmake/version.cmake)
include(GNUInstallDirs)
include(CheckCXXCompilerFlag)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
......@@ -64,7 +65,14 @@ if (USINGISYSTEM AND GCC_VERSION VERSION_LESS 6.0)
endforeach()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall ${CXX_ISYSTEM_DIRS}")
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}")
endif()
add_subdirectory(examples)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment