-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCompileOptions.cmake
More file actions
50 lines (40 loc) · 1.07 KB
/
CompileOptions.cmake
File metadata and controls
50 lines (40 loc) · 1.07 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
#
# Project options
#
set(DEFAULT_PROJECT_OPTIONS
C_STANDARD 11
LINKER_LANGUAGE "C"
POSITION_INDEPENDENT_CODE ON
)
#
# Compile options
#
set(DEFAULT_COMPILE_OPTIONS)
# GCC and Clang compiler options
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
PRIVATE
-Wall
-Wextra
-Wunused
#-Werror
-Wignored-qualifiers
-Wmissing-braces
-Wreturn-type
-Wswitch
-Wswitch-default
-Wuninitialized
-Wmissing-field-initializers
$<$<C_COMPILER_ID:GNU>:
-Wmaybe-uninitialized
$<$<VERSION_GREATER:$<C_COMPILER_VERSION>,4.8>:
-Wpedantic
-Wreturn-local-addr
>
>
$<$<C_COMPILER_ID:Clang>:
-Wpedantic
# -Wreturn-stack-address # gives false positives
>
)
endif ()