-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathset_compiler_warnings.cmake
More file actions
127 lines (121 loc) · 5.03 KB
/
set_compiler_warnings.cmake
File metadata and controls
127 lines (121 loc) · 5.03 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# Copyright (C) 2017-2026 Topological Manifold
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
function(set_compiler_warnings source_files)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:GNU>:
-Werror
-Wall
-Wextra
-Wcast-align
-Wcast-qual
-Wdate-time
-Wdisabled-optimization
-Wduplicated-branches
-Wduplicated-cond
-Wenum-compare
-Wformat-signedness
-Wformat=2
-Wframe-larger-than=25000
-Wimplicit-fallthrough=5
-Winit-self
-Wlarger-than=1000000
-Wleading-whitespace=spaces
-Wlogical-op
-Wmissing-declarations
-Wmissing-format-attribute
-Wmissing-include-dirs
-Wnrvo
-Wpacked
-Wredundant-decls
-Wshadow=local
-Wstack-usage=25000
-Wstrict-aliasing=3
-Wstrict-overflow=1
-Wsuggest-attribute=format
-Wsuggest-attribute=noreturn
-Wswitch-enum
-Wtrailing-whitespace=any
-Wtrampolines
-Wundef
-Wunreachable-code
-Wunused
-Wunused-parameter
-Wvla
-Wwrite-strings
$<$<COMPILE_LANGUAGE:CXX>:
-Wconditionally-supported
-Wctor-dtor-privacy
-Wextra-semi
-Wnon-virtual-dtor
-Wold-style-cast
-Woverloaded-virtual
-Wplacement-new=2
-Wsign-promo
-Wsuggest-final-methods
-Wsuggest-final-types
-Wsuggest-override
-Wvirtual-inheritance
-Wzero-as-null-pointer-constant
>
$<$<COMPILE_LANGUAGE:C>:
-Waggregate-return
-Wbad-function-cast
-Wc++-compat
-Wjump-misses-init
-Wmissing-prototypes
-Wnested-externs
-Wold-style-definition
-Wstrict-prototypes
-Wunsuffixed-float-constants
>
>
$<$<CXX_COMPILER_ID:Clang>:
-Werror
-Weverything
$<$<COMPILE_LANGUAGE:CXX>:
-Wno-c++20-compat-pedantic
-Wno-c++98-compat-pedantic
-Wno-cast-function-type-strict
-Wno-conversion
-Wno-double-promotion
-Wno-exit-time-destructors
-Wno-float-equal
-Wno-nrvo
-Wno-padded
-Wno-shadow-field-in-constructor
-Wno-shadow-uncaptured-local
-Wno-switch-default
-Wno-thread-safety-negative
-Wno-unsafe-buffer-usage
-Wno-weak-template-vtables
-Wno-weak-vtables
-Wno-ctad-maybe-unsupported
-Wno-undefined-func-template
# Qt
-Wno-reserved-identifier
>
>
)
# foreach(f ${source_files})
# if (${f} MATCHES "^.+\.cpp$")
# if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
# string(CONCAT flags)
# set_source_files_properties(${f} PROPERTIES COMPILE_FLAGS ${flags})
# endif()
# endif()
# endforeach()
endfunction()