-
-
Notifications
You must be signed in to change notification settings - Fork 331
/
Copy pathAddWarnings.cmake
55 lines (51 loc) · 1.1 KB
/
AddWarnings.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
include("DetectCompiler")
function(TARGET_ADD_WARNINGS TARGET)
if((TARGET_COMPILER_GCC) OR (TARGET_COMPILER_CLANG))
target_compile_options(${TARGET}
PUBLIC
-W
-Wall
#-Wshadow
-Wnon-virtual-dtor
#-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-pedantic
#-Wconversion
#-Wsign-conversion
#-Wnull-dereference
-Wdouble-promotion
-Wformat=2
-Wno-unused-macros
-Wno-switch-enum
-Wno-unknown-pragmas
-Wimplicit-fallthrough
)
if(TARGET_COMPILER_CLANG)
target_compile_options(${TARGET}
PUBLIC
#-Wexit-time-destructors
#-Wglobal-constructors
#-Wshadow-uncaptured-local
#-Wshorten-64-to-32
-Wconditional-uninitialized
-Wmissing-prototypes
)
elseif(TARGET_COMPILER_GCC)
target_compile_options(${TARGET}
PUBLIC
#-Wduplicated-branches
#-Wduplicated-cond
#-Wsuggest-attribute=const
#-Wsuggest-attribute=noreturn
#-Wsuggest-attribute=pure
#-Wsuggest-final-methods
#-Wsuggest-final-types
#-Wuseless-cast
-Wlogical-op
-Wsuggest-override
)
endif()
endif()
endfunction()