Add BUILD_WERROR option
Adds a cmake BUILD_WERROR option to enable warnings as errors. This option is off by default. This change also cleans up a few more compiler warnings.
This commit is contained in:
parent
719b6b7deb
commit
3f615ad93e
6 changed files with 22 additions and 12 deletions
|
|
@ -44,6 +44,7 @@ include(CMakeDependentOption)
|
|||
|
||||
option(BUILD_SHARED_LIBS "Build Shared Libraries")
|
||||
option(BUILD_EXTERNAL "Build external dependencies in /External" ON)
|
||||
option(BUILD_WERROR "Enable warnings as errors (default is OFF)" OFF)
|
||||
|
||||
set(LIB_TYPE STATIC)
|
||||
|
||||
|
|
@ -177,6 +178,15 @@ elseif(MSVC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# NOTE we could potentially replace this logic with COMPILE_WARNING_AS_ERROR if cmake minimum is bumped to >= 3.24
|
||||
if (BUILD_WERROR)
|
||||
if (NOT MSVC)
|
||||
add_compile_options(-Werror)
|
||||
else()
|
||||
add_compile_options(/WX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_GLSLANG_JS)
|
||||
if(MSVC)
|
||||
add_compile_options(/Os /GR-)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue