mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41:05 +08:00
Fix cmake -DWARNINGS_AS_ERRORS=1 for clang
This commit is contained in:
parent
fbc866c5c9
commit
aae00e9002
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user