Skip to content

Commit

Permalink
conversion errors only if warnings as errors enabled (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm authored May 6, 2021
1 parent ed1ab7a commit 5fabc5e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using regular Clang or AppleClang
add_compile_options(-Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare)
add_compile_options(-Wall -Wconversion -Wshadow)

if(JSONCPP_WITH_WARNING_AS_ERROR)
add_compile_options(-Werror=conversion -Werror=sign-compare)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
add_compile_options(-Wall -Wconversion -Wshadow -Wextra)
Expand All @@ -148,9 +152,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# using Intel compiler
add_compile_options(-Wall -Wconversion -Wshadow -Wextra -Werror=conversion)
add_compile_options(-Wall -Wconversion -Wshadow -Wextra)

if(JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
if(JSONCPP_WITH_WARNING_AS_ERROR)
add_compile_options(-Werror=conversion)
elseif(JSONCPP_WITH_STRICT_ISO)
add_compile_options(-Wpedantic)
endif()
endif()
Expand Down

0 comments on commit 5fabc5e

Please sign in to comment.