Merge pull request #2776 from dylankenneally/warning-level-max

Added CMake option to set the compiler warning to max (-Wall, /W4). Off by default
pull/2841/head
Kim Kulling 2019-12-18 01:00:29 +01:00 committed by GitHub
commit 03e6e0c69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -77,6 +77,7 @@ The cmake-build-environment provides options to configure the build. The followi
- **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut).
- **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library.
- **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage.
- **ASSIMP_ERROR_MAX( default OFF)**: Enable all warnings.
- **ASSIMP_WERROR( default OFF )**: Treat warnings as errors.
- **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer.
- **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer.

View File

@ -100,6 +100,10 @@ OPTION ( ASSIMP_COVERALLS
"Enable this to measure test coverage."
OFF
)
OPTION ( ASSIMP_ERROR_MAX
"Enable all warnings."
OFF
)
OPTION ( ASSIMP_WERROR
"Treat warnings as errors."
OFF
@ -294,6 +298,16 @@ IF (ASSIMP_COVERALLS)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
ENDIF()
IF (ASSIMP_ERROR_MAX)
MESSAGE(STATUS "Turning on all warnings")
IF (MSVC)
ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ENDIF()
ENDIF()
IF (ASSIMP_WERROR)
MESSAGE(STATUS "Treating warnings as errors")
IF (MSVC)