-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathGlobalSettingsInclude.cmake
More file actions
155 lines (119 loc) · 4.81 KB
/
Copy pathGlobalSettingsInclude.cmake
File metadata and controls
155 lines (119 loc) · 4.81 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Options common to all RSC builds
#
# - if(MSVC) is true for both MSVC and clang builds
# - clang is currently used only to target Windows (x64)
# - GCC is used only to target Linux (x64)
# - x86 uses "Visual Studio 17 2022" generator instead of Ninja
#
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
message("** Reading global settings shared by MSVC and CLang")
# Enable Windows targets (*.win.cpp files)
add_compile_definitions(OS_WIN)
# Use async exception handling to catch structured exceptions
add_compile_options(/EHa)
# Disable optimizations to improve debugging
add_compile_options(/Od)
# Keep frame pointers
add_compile_options(/Oy-)
# Include security checks
add_compile_options(/GS)
# Enable all compiler warnings
add_compile_options(/Wall)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("** Reading global settings for MSVC")
# For definitions in subs/cstddef
add_compile_definitions(MSVC_COMPILER)
# Include run-time checks
add_compile_options(/RTC1)
# Provide full debugging information
add_compile_options(/Z7)
# Disable Just My Code debugging
add_compile_options(/JMC-)
# Use standard C++
add_compile_options(/permissive-)
# Treat compiler security warnings as errors
add_compile_options(/sdl)
# Compiler warnings to treat as errors
add_compile_options(/we4715)
# Compiler warnings to suppress
add_compile_options(/wd4061 /wd4062 /wd4100 /wd4242 /wd4244 /wd4267)
add_compile_options(/wd4365 /wd4514 /wd4582 /wd4623 /wd4625 /wd4626)
add_compile_options(/wd4668 /wd4710 /wd4711 /wd4820 /wd5026 /wd5027)
add_compile_options(/wd5045 /wd5219 /wd26812)
# Include debugging information
add_link_options(/DEBUG:FULL)
# Do not merge identical functions or data
add_link_options(/OPT:NOICF)
# Support incremental linking for patching
add_link_options(/INCREMENTAL)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message("** Reading global settings for Clang")
# Provide full debugging information
add_compile_options(/Zi)
# Disable specific compiler warnings
add_compile_options(-Wno-c++98-compat)
add_compile_options(-Wno-c++98-compat-pedantic)
add_compile_options(-Wno-cast-align)
add_compile_options(-Wno-cast-qual)
add_compile_options(-Wno-covered-switch-default)
add_compile_options(-Wno-exit-time-destructors)
add_compile_options(-Wno-global-constructors)
add_compile_options(-Wno-header-hygiene)
add_compile_options(-Wno-implicit-int-conversion)
add_compile_options(-Wno-implicit-int-float-conversion)
add_compile_options(-Wno-inconsistent-missing-destructor-override)
add_compile_options(-Wno-missing-noreturn)
add_compile_options(-Wno-old-style-cast)
add_compile_options(-Wno-shadow)
add_compile_options(-Wno-shadow-field-in-constructor)
add_compile_options(-Wno-shorten-64-to-32)
add_compile_options(-Wno-sign-compare)
add_compile_options(-Wno-sign-conversion)
add_compile_options(-Wno-suggest-destructor-override)
add_compile_options(-Wno-switch)
add_compile_options(-Wno-switch-enum)
add_compile_options(-Wno-tautological-type-limit-compare)
add_compile_options(-Wno-tautological-undefined-compare)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unreachable-code-break)
add_compile_options(-Wno-unreachable-code-return)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("** Reading global settings for GCC")
# Enable Linux targets (*.linux.cpp files)
add_compile_definitions(OS_LINUX)
# Increase reliability of stack traces
add_compile_options(-fasynchronous-unwind-tables)
# Enable exceptions
add_compile_options(-fexceptions)
# Allow signal handler to throw a C++ exception
add_compile_options(-fnon-call-exceptions)
# Support function names in stack traces
add_link_options(-fno-pie)
# Allow typedefs that hide underlying types in subs/chrono to compile
add_compile_options(-fpermissive)
# Generate debugging information
add_compile_options(-g)
# Disable optimizations
add_compile_options(-O0)
# Enable POSIX threads
add_compile_options(-pthread)
# Enable function names in stack traces
add_compile_options(-rdynamic)
# Enable all compiler warnings
add_compile_options(-Wall)
# Disable specific compiler warnings
add_compile_options(-Wno-address)
add_compile_options(-Wno-nonnull-compare)
add_compile_options(-Wno-switch)
# Support function names in stack traces
add_link_options(-ldl)
add_link_options(-no-pie)
# Enable POSIX threads
add_link_options(-pthread)
# Enable function names in stack traces
add_link_options(-rdynamic)
else()
message(FATAL_ERROR "** ${CMAKE_CXX_COMPILER_ID} compiler is not supported")
endif()