@@ -31,6 +31,10 @@ option(RAPIDJSON_BUILD_THIRDPARTY_GTEST
31
31
"Use gtest installation in `thirdparty/gtest` by default if available" OFF )
32
32
33
33
option (RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11 (gcc/clang)" ON )
34
+ if (RAPIDJSON_BUILD_CXX11 )
35
+ set (CMAKE_CXX_STANDARD 11 )
36
+ set (CMAKE_CXX_STANDARD_REQUIRED TRUE )
37
+ endif ()
34
38
35
39
option (RAPIDJSON_BUILD_ASAN "Build rapidjson with address sanitizer (gcc/clang)" OFF )
36
40
option (RAPIDJSON_BUILD_UBSAN "Build rapidjson with undefined behavior sanitizer (gcc/clang)" OFF )
@@ -62,7 +66,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
62
66
endif ()
63
67
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror" )
64
68
set (EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wsign-conversion )
65
- if (RAPIDJSON_BUILD_CXX11 )
69
+ if (RAPIDJSON_BUILD_CXX11 AND CMAKE_VERSION VERSION_LESS 3.1 )
66
70
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0" )
67
71
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
68
72
else ()
@@ -94,7 +98,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
94
98
endif ()
95
99
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-missing-field-initializers" )
96
100
set (EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wimplicit-fallthrough )
97
- if (RAPIDJSON_BUILD_CXX11 )
101
+ if (RAPIDJSON_BUILD_CXX11 AND CMAKE_VERSION VERSION_LESS 3.1 )
98
102
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
99
103
endif ()
100
104
if (RAPIDJSON_BUILD_ASAN )
0 commit comments