From c31e49198adfe2cff7dd12591c0378c7434b5178 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 31 Mar 2020 22:01:04 +0200 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/3103: always enable warnings as errors . --- CMakeLists.txt | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ecd131b8c..ca6c3533a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,10 +108,6 @@ OPTION ( ASSIMP_ERROR_MAX "Enable all warnings." OFF ) -OPTION ( ASSIMP_WERROR - "Treat warnings as errors." - OFF -) OPTION ( ASSIMP_ASAN "Enable AddressSanitizer." OFF @@ -243,7 +239,15 @@ IF( UNIX ) INCLUDE(GNUInstallDirs) ENDIF() -# Grouped compiler settings +# enable warnings as errors ######################################## +IF (MSVC) + ADD_COMPILE_OPTIONS(/WX) +ELSE() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") +ENDIF() + +# Grouped compiler settings ######################################## IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) IF(NOT ASSIMP_HUNTER_ENABLED) SET(CMAKE_CXX_FLAGS "-fPIC -std=c++0x ${CMAKE_CXX_FLAGS}") @@ -311,16 +315,6 @@ IF (ASSIMP_ERROR_MAX) ENDIF() ENDIF() -IF (ASSIMP_WERROR) - MESSAGE(STATUS "Treating warnings as errors") - IF (MSVC) - ADD_COMPILE_OPTIONS(/WX) - ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - ENDIF() -ENDIF() - IF (ASSIMP_ASAN) MESSAGE(STATUS "AddressSanitizer enabled") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")