blob: 8e04f66abb24c2b4b0cdc8eedec20a0e238b7e4a (
plain)
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
|
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(trinity-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>")
if(WITH_WARNINGS)
target_compile_options(trinity-warning-interface
INTERFACE
-W
-Wall
-Wextra
-Winit-self
-Wfatal-errors
-Wno-mismatched-tags
-Woverloaded-virtual)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
target_compile_options(trinity-warning-interface
INTERFACE
-Wno-deprecated-copy) # warning in g3d
endif()
message(STATUS "Clang: All warnings enabled")
endif()
if(WITH_COREDEBUG)
target_compile_options(trinity-compile-option-interface
INTERFACE
-g3)
message(STATUS "Clang: Debug-flags set (-g3)")
endif()
if(ASAN)
target_compile_options(trinity-compile-option-interface
INTERFACE
-fno-omit-frame-pointer
-fsanitize=address
-fsanitize-recover=address
-fsanitize-address-use-after-scope)
target_link_options(trinity-compile-option-interface
INTERFACE
-fno-omit-frame-pointer
-fsanitize=address
-fsanitize-recover=address
-fsanitize-address-use-after-scope)
message(STATUS "Clang: Enabled Address Sanitizer")
endif()
# -Wno-narrowing needed to suppress a warning in g3d
# -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems.
# -Wno-deprecated-copy needed to suppress a warning in g3d
target_compile_options(trinity-compile-option-interface
INTERFACE
-Wno-narrowing
-Wno-deprecated-register)
if(BUILD_SHARED_LIBS)
# -fPIC is needed to allow static linking in shared libs.
# -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols.
target_compile_options(trinity-compile-option-interface
INTERFACE
-fPIC)
target_compile_options(trinity-hidden-symbols-interface
INTERFACE
-fvisibility=hidden)
# --no-undefined to throw errors when there are undefined symbols
# (caused through missing TRINITY_*_API macros).
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined")
message(STATUS "Clang: Disallow undefined symbols")
endif()
|