Skip to content

Commit

Permalink
Merge pull request #51 from cpp-best-practices/warnings-emergency-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Jan 30, 2022
2 parents 3cb79f0 + 0a017e5 commit d69eca9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(
MSVC_WARNINGS
CLANG_WARNINGS
GCC_WARNINGS)
if(NOT ${MSVC_WARNINGS})
if("${MSVC_WARNINGS}" STREQUAL "")
set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
Expand Down Expand Up @@ -37,7 +37,7 @@ function(
)
endif()

if(NOT ${CLANG_WARNINGS})
if("${CLANG_WARNINGS}" STREQUAL "")
set(CLANG_WARNINGS
-Wall
-Wextra # reasonable and standard
Expand All @@ -58,7 +58,7 @@ function(
)
endif()

if(NOT ${GCC_WARNINGS})
if("${GCC_WARNINGS}" STREQUAL "")
set(GCC_WARNINGS
${CLANG_WARNINGS}
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
Expand All @@ -69,8 +69,8 @@ function(
)
endif()

if(WARNINGS_AS_ERRORS STREQUAL TRUE)
message(AUTHOR_WARNING "NOTE: WARNINGS_AS_ERRORS=${WARNINGS_AS_ERRORS}")
if(WARNINGS_AS_ERRORS)
message(TRACE "Warnings are treated as errors")
list(APPEND CLANG_WARNINGS -Werror)
list(APPEND GCC_WARNINGS -Werror)
list(APPEND MSVC_WARNINGS /WX)
Expand Down

0 comments on commit d69eca9

Please sign in to comment.