@@ -95,23 +95,11 @@ macro(use_compilation_warning_as_error)
9595 if (MSVC )
9696 # Only enabled in debug because some old versions of VS STL generate
9797 # 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>)
10399 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)
109101 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)
115103 endif ()
116104 endif ()
117105endmacro ()
@@ -122,57 +110,29 @@ include_directories(${jsoncpp_SOURCE_DIR}/include)
122110if (MSVC )
123111 # Only enabled in debug because some old versions of VS STL generate
124112 # 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>)
130114endif ()
131115
132116if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
133117 # 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)
139119elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
140120 # 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)
146122 # not yet ready for -Wsign-conversion
147123
148124 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)
154126 endif ()
155127 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)
161129 endif ()
162130elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
163131 # 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)
169133
170134 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)
176136 endif ()
177137endif ()
178138
0 commit comments