@@ -95,23 +95,11 @@ macro(use_compilation_warning_as_error)
95
95
if (MSVC )
96
96
# Only enabled in debug because some old versions of VS STL generate
97
97
# warnings when compiled in release configuration.
98
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
99
- add_compile_options ($<$<CONFIG:Debug>:/WX>)
100
- else ()
101
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX " )
102
- endif ()
98
+ add_compile_options ($<$<CONFIG:Debug>:/WX>)
103
99
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
104
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
105
- add_compile_options (-Werror)
106
- else ()
107
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
108
- endif ()
100
+ add_compile_options (-Werror)
109
101
if (JSONCPP_WITH_STRICT_ISO)
110
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
111
- add_compile_options (-pedantic-errors)
112
- else ()
113
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors" )
114
- endif ()
102
+ add_compile_options (-pedantic-errors)
115
103
endif ()
116
104
endif ()
117
105
endmacro ()
@@ -122,57 +110,29 @@ include_directories(${jsoncpp_SOURCE_DIR}/include)
122
110
if (MSVC )
123
111
# Only enabled in debug because some old versions of VS STL generate
124
112
# unreachable code warning when compiled in release configuration.
125
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
126
- add_compile_options ($<$<CONFIG:Debug>:/W4>)
127
- else ()
128
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 " )
129
- endif ()
113
+ add_compile_options ($<$<CONFIG:Debug>:/W4>)
130
114
endif ()
131
115
132
116
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
133
117
# using regular Clang or AppleClang
134
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
135
- add_compile_options (-Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare)
136
- else ()
137
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare" )
138
- endif ()
118
+ add_compile_options (-Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare)
139
119
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
140
120
# using GCC
141
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
142
- add_compile_options (-Wall -Wconversion -Wshadow -Wextra)
143
- else ()
144
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Wextra" )
145
- endif ()
121
+ add_compile_options (-Wall -Wconversion -Wshadow -Wextra)
146
122
# not yet ready for -Wsign-conversion
147
123
148
124
if (JSONCPP_WITH_STRICT_ISO)
149
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
150
- add_compile_options (-Wpedantic)
151
- else ()
152
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic" )
153
- endif ()
125
+ add_compile_options (-Wpedantic)
154
126
endif ()
155
127
if (JSONCPP_WITH_WARNING_AS_ERROR)
156
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
157
- add_compile_options (-Werror=conversion)
158
- else ()
159
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion" )
160
- endif ()
128
+ add_compile_options (-Werror=conversion)
161
129
endif ()
162
130
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
163
131
# using Intel compiler
164
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
165
- add_compile_options (-Wall -Wconversion -Wshadow -Wextra -Werror=conversion)
166
- else ()
167
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Wextra -Werror=conversion" )
168
- endif ()
132
+ add_compile_options (-Wall -Wconversion -Wshadow -Wextra -Werror=conversion)
169
133
170
134
if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
171
- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
172
- add_compile_options (-Wpedantic)
173
- else ()
174
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic" )
175
- endif ()
135
+ add_compile_options (-Wpedantic)
176
136
endif ()
177
137
endif ()
178
138
0 commit comments