]> git.ipfire.org Git - thirdparty/ccache.git/blob - cmake/StandardWarnings.cmake
fix: Avoid crash for -arch as last compiler option
[thirdparty/ccache.git] / cmake / StandardWarnings.cmake
1 # This file provides a special "standard_warnings" target which is supposed to
2 # be linked privately by all product and test code, but not by third party code.
3 add_library(standard_warnings INTERFACE)
4
5 if(CCACHE_DEV_MODE)
6 # Enabled by default for developer builds.
7 option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE)
8 else()
9 # Disabled by default for user builds so compilation doesn't fail with new
10 # compilers that may emit new warnings.
11 option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" FALSE)
12 endif()
13
14 if(NOT MSVC)
15 set(CCACHE_COMPILER_WARNINGS -Wall)
16 endif()
17
18 if(CCACHE_DEV_MODE)
19 include(DevModeWarnings)
20 endif()
21
22 target_compile_options(standard_warnings INTERFACE ${CCACHE_COMPILER_WARNINGS})