Skip to content

Commit

Permalink
Issue #106: using CMake properties for setting C++ standard
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhoshkun committed Apr 29, 2019
1 parent d437486 commit aca6748
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/cmake/cpp11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0)

# C++11
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++11")
else()
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX0X)
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x")
else()
MESSAGE(FATAL_ERROR
"The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
endif()
endif()
LIST(REMOVE_DUPLICATES CMAKE_CXX_FLAGS)
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}
CACHE INTERNAL "C++11 flag set")
SET(CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 11)

0 comments on commit aca6748

Please sign in to comment.