mirror of
https://github.com/Z3Prover/z3
synced 2025-07-31 00:13:16 +00:00
[CMake] Change the WARNINGS_AS_ERRORS
option from BOOL to STRING
to allow a new mode `SERIOUS_ONLY`. Modes: `ON` - All warnings are treated as errors (same as before) `OFF` - Warnings are not treated as errors (same as before) `SERIOUS_ONLY` - A subset of "serious" warnings are treated as errors. Upgrade code is included to upgrade old CMake cache's to use the new type of `WARNINGS_AS_ERRORS`. We should remove it eventually. The user's previous setting is preserved when doing this. Very few warnings are treated as errors for now. Developers can add more later as they see fit.
This commit is contained in:
parent
2af08a378d
commit
6e2ca69654
3 changed files with 111 additions and 8 deletions
|
@ -2,7 +2,7 @@ include(CheckCXXCompilerFlag)
|
|||
include(CMakeParseArguments)
|
||||
|
||||
function(z3_add_cxx_flag flag)
|
||||
CMAKE_PARSE_ARGUMENTS(z3_add_flag "REQUIRED" "" "" ${ARGN})
|
||||
CMAKE_PARSE_ARGUMENTS(z3_add_flag "REQUIRED;GLOBAL" "" "" ${ARGN})
|
||||
string(REPLACE "-" "_" SANITIZED_FLAG_NAME "${flag}")
|
||||
string(REPLACE "/" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||
string(REPLACE "=" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||
|
@ -16,8 +16,13 @@ function(z3_add_cxx_flag flag)
|
|||
endif()
|
||||
if (HAS_${SANITIZED_FLAG_NAME})
|
||||
message(STATUS "C++ compiler supports ${flag}")
|
||||
list(APPEND Z3_COMPONENT_CXX_FLAGS "${flag}")
|
||||
set(Z3_COMPONENT_CXX_FLAGS "${Z3_COMPONENT_CXX_FLAGS}" PARENT_SCOPE)
|
||||
if (z3_add_flag_GLOBAL)
|
||||
# Set globally
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag} " PARENT_SCOPE)
|
||||
else()
|
||||
list(APPEND Z3_COMPONENT_CXX_FLAGS "${flag}")
|
||||
set(Z3_COMPONENT_CXX_FLAGS "${Z3_COMPONENT_CXX_FLAGS}" PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "C++ compiler does not support ${flag}")
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue