Unverified Commit 99afd41f by Edward Thomson Committed by GitHub

Merge pull request #4924 from lhchavez/werror

Make ENABLE_WERROR actually work
parents 3afa1ede 6af6170b
......@@ -7,7 +7,8 @@ INCLUDE(CheckCCompilerFlag)
MACRO(ADD_C_FLAG _FLAG)
STRING(TOUPPER ${_FLAG} UPCASE)
STRING(REGEX REPLACE "^-" "" UPCASE_PRETTY ${UPCASE})
STRING(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
STRING(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
CHECK_C_COMPILER_FLAG(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
IF(IS_${UPCASE_PRETTY}_SUPPORTED)
......@@ -19,7 +20,8 @@ ENDMACRO()
MACRO(ADD_C_FLAG_IF_SUPPORTED _FLAG)
STRING(TOUPPER ${_FLAG} UPCASE)
STRING(REGEX REPLACE "^-" "" UPCASE_PRETTY ${UPCASE})
STRING(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
STRING(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
CHECK_C_COMPILER_FLAG(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
IF(IS_${UPCASE_PRETTY}_SUPPORTED)
......
MACRO(ENABLE_WARNINGS flag)
IF(ENABLE_WERROR)
ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
ELSE()
ADD_C_FLAG_IF_SUPPORTED(-W${flag})
ENDIF()
ENDMACRO()
MACRO(DISABLE_WARNINGS flag)
ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
IF(ENABLE_WERROR)
ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
ENDIF()
ENDMACRO()
IF(ENABLE_WERROR)
ADD_C_FLAG_IF_SUPPORTED(-Werror)
ENDIF()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment