From aae00e9002f12ce7c24a8ab8392de6cf950dd896 Mon Sep 17 00:00:00 2001 From: Pawel Paruzel Date: Thu, 16 Dec 2021 09:54:15 +0100 Subject: [PATCH] Fix cmake -DWARNINGS_AS_ERRORS=1 for clang --- cmake/CompilerWarnings.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index b6c95bb6b..975f890d1 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -4,7 +4,12 @@ # Helper function to enable compiler warnings for a specific set of files function(set_file_warnings) - option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE) + if(APPLE) + # Temporarily disable Apple default until warnings are fixed + option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" FALSE) + else() + option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE) + endif() set(MSVC_WARNINGS /W4 # Baseline reasonable warnings @@ -69,17 +74,16 @@ function(set_file_warnings) ${NON_ANDROID_CLANG_AND_GCC_WARNINGS} ) + if(WARNINGS_AS_ERRORS) + set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror) + set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX) + endif() set(CLANG_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas ) - if(WARNINGS_AS_ERRORS) - set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror) - set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX) - endif() - set(GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} ${NON_ANDROID_GCC_WARNINGS}