@@ -103,27 +103,18 @@ macro(dynamic_project_options)
103
103
)
104
104
endif ()
105
105
106
- check_sanitizers_support(
107
- ENABLE_SANITIZER_ADDRESS
108
- ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
109
- ENABLE_SANITIZER_LEAK
110
- ENABLE_SANITIZER_THREAD
111
- ENABLE_SANITIZER_MEMORY
112
- ENABLE_SANITIZER_POINTER_COMPARE
113
- ENABLE_SANITIZER_POINTER_SUBTRACT
114
- )
115
-
116
- if (ENABLE_SANITIZER_ADDRESS)
117
- set (SUPPORTS_ASAN ON )
118
- else ()
119
- set (SUPPORTS_ASAN OFF )
120
- endif ()
106
+ # Fallback for ENABLE_SANITIZER_UNDEFINED_BEHAVIOR option
107
+ foreach (default_type IN ITEMS DEFAULT DEVELOPER_DEFAULT USER_DEFAULT)
108
+ if (DEFINED ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} )
109
+ if (DEFINED ENABLE_SANITIZER_UNDEFINED_${default_type} )
110
+ message (WARNING "Don't set both ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} and ENABLE_SANITIZER_UNDEFINED_${default_type} . Use ENABLE_SANITIZER_UNDEFINED_${default_type} only." )
111
+ else ()
112
+ message (DEPRECATION "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} is deprecated. Use ENABLE_SANITIZER_UNDEFINED_${default_type} instead." )
113
+ endif ()
121
114
122
- if (ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
123
- set (SUPPORTS_UBSAN ON )
124
- else ()
125
- set (SUPPORTS_UBSAN OFF )
126
- endif ()
115
+ set (ENABLE_SANITIZER_UNDEFINED_${default_type} ${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} })
116
+ endif ()
117
+ endforeach ()
127
118
128
119
# ccache, clang-tidy, cppcheck are only supported with Ninja and Makefile based generators
129
120
# note that it is possible to use Ninja with cl, so this still allows clang-tidy on Windows
@@ -163,9 +154,9 @@ macro(dynamic_project_options)
163
154
"0\; DISABLE_RTTI\; OFF\; OFF\; Disable RTTI (no-rtti flag)"
164
155
"0\; ENABLE_BUILD_WITH_TIME_TRACE\; OFF\; OFF\; Generates report of where compile-time is spent"
165
156
"0\; ENABLE_UNITY\; OFF\; OFF\; Merge C++ files into larger C++ files, can speed up compilation sometimes"
166
- "0\; ENABLE_SANITIZER_ADDRESS\; OFF\; ${SUPPORTS_ASAN} \; Make memory errors into hard runtime errors (windows/linux/macos)"
157
+ "0\; ENABLE_SANITIZER_ADDRESS\; OFF\; ON \; Make memory errors into hard runtime errors (windows/linux/macos)"
167
158
"0\; ENABLE_SANITIZER_LEAK\; OFF\; OFF\; Make memory leaks into hard runtime errors"
168
- "0\; ENABLE_SANITIZER_UNDEFINED_BEHAVIOR \; OFF\; ${SUPPORTS_UBSAN} \; Make certain types (numeric mostly) of undefined behavior into runtime errors"
159
+ "0\; ENABLE_SANITIZER_UNDEFINED \; OFF\; ON \; Make certain types (numeric mostly) of undefined behavior into runtime errors"
169
160
"0\; ENABLE_SANITIZER_THREAD\; OFF\; OFF\; Make thread race conditions into hard runtime errors"
170
161
"0\; ENABLE_SANITIZER_MEMORY\; OFF\; OFF\; Make other memory errors into runtime errors"
171
162
"0\; ENABLE_CONTROL_FLOW_PROTECTION\; OFF\; OFF\; Enable control flow protection instrumentation"
@@ -277,7 +268,7 @@ macro(dynamic_project_options)
277
268
${ENABLE_UNITY_VALUE}
278
269
${ENABLE_SANITIZER_ADDRESS_VALUE}
279
270
${ENABLE_SANITIZER_LEAK_VALUE}
280
- ${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_VALUE }
271
+ ${ENABLE_SANITIZER_UNDEFINED_VALUE }
281
272
${ENABLE_SANITIZER_THREAD_VALUE}
282
273
${ENABLE_SANITIZER_MEMORY_VALUE}
283
274
${ENABLE_CONTROL_FLOW_PROTECTION_VALUE}
0 commit comments