1
1
cmake_minimum_required (VERSION 2.8 )
2
2
3
- # Check if a supported compiler is used and add c++14 flag:
3
+ # Check if a supported compiler is used and add c++11 flag:
4
4
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
5
5
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 )
6
6
message (FATAL_ERROR "Need at least gcc 4.9 to compile." )
7
7
endif ()
8
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 " )
8
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 " )
9
9
elseif (MSVC )
10
10
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19 )
11
11
message (FATAL_ERROR "Visual Studio 2015 or newer is required." )
12
12
endif ()
13
13
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
14
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" )
14
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0 )
15
+ message (FATAL_ERROR "Need at least AppleClang 7.0 to compile." )
16
+ endif ()
17
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
15
18
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
16
19
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4 )
17
20
message (FATAL_ERROR "Clang below version 3.4 will most likely not work. Please upgrade your compiler." )
18
21
endif ()
19
-
20
- if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6 )
21
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y" )
22
- else ()
23
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" )
24
- endif ()
22
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
25
23
else () # no GNU, no MSVC, no Clang
26
24
message (WARNING "You are using an unsupported compiler. Compilation has only been tested with MSVC, GCC and Clang." )
27
25
28
26
include (CheckCXXCompilerFlag )
29
- check_cxx_compiler_flag (-std=c++14 HAS_CXX14_FLAG )
30
- if (HAS_CXX14_FLAG )
31
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 " )
27
+ check_cxx_compiler_flag (-std=c++11 HAS_CXX11_FLAG )
28
+ if (HAS_CXX11_FLAG )
29
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 " )
32
30
else ()
33
- message (FATAL_ERROR "Your compiler doesn't support the '-std=c++14 ' flag." )
31
+ message (FATAL_ERROR "Your compiler doesn't support the '-std=c++11 ' flag." )
34
32
endif ()
35
33
endif ()
36
34
@@ -73,4 +71,4 @@ if(NOT MSVC)
73
71
add_subdirectory (lint )
74
72
add_subdirectory (language /pl0 )
75
73
add_subdirectory (language /culebra )
76
- endif ()
74
+ endif ()
0 commit comments