Skip to content

Commit b843322

Browse files
committed
Merge pull request open-source-parsers#463 from jmealins/fix-errors-as-warnings
Fix JSONCPP_WITH_WARNING_AS_ERROR
2 parents d2fc18a + cb3b38c commit b843322

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.in"
8181
NEWLINE_STYLE UNIX )
8282

8383
macro(UseCompilationWarningAsError)
84-
if ( MSVC )
85-
# Only enabled in debug because some old versions of VS STL generate
86-
# warnings when compiled in release configuration.
87-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
88-
endif()
84+
if ( MSVC )
85+
# Only enabled in debug because some old versions of VS STL generate
86+
# warnings when compiled in release configuration.
87+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
88+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_XX_COMPILER_ID MATCHES "Clang" )
89+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
90+
endif()
8991
endmacro()
9092

9193
# Include our configuration header
@@ -99,10 +101,10 @@ endif()
99101

100102
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
101103
# using regular Clang or AppleClang
102-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wall -Wshadow -Wshorten-64-to-32")
104+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wshorten-64-to-32")
103105
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
104106
# using GCC
105-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wshadow -Wextra -pedantic -Wno-long-long")
107+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wextra -pedantic -Wno-long-long")
106108
# not yet ready for -Wsign-conversion
107109
endif()
108110

0 commit comments

Comments
 (0)