@@ -53,6 +53,7 @@ option(ENABLE_COVERAGE "Whether to turn unit test coverage ON or OFF" OFF)
53
53
option (ENABLE_UBSAN "Whether to turn Undefined Behavior Sanitizer ON or OFF" OFF )
54
54
option (ENABLE_FUZZ_TEST "Whether to turn Fuzz Test ON or OFF" OFF )
55
55
option (ENABLE_WERROR "Whether to error on warnings" ON )
56
+ option (ENABLE_STRICT_ALIASING "Whether to turn strict-aliasing ON or OFF" OFF )
56
57
option (ENABLE_TSAN "Whether to turn Thread Sanitizer ON or OFF" OFF )
57
58
option (ENABLE_STATIC_ASAN "Whether directs the GCC driver to link libasan statically" OFF )
58
59
option (ENABLE_STATIC_UBSAN "Whether directs the GCC driver to link libubsan statically" OFF )
@@ -65,9 +66,8 @@ message(STATUS "ENABLE_FUZZ_TEST: ${ENABLE_FUZZ_TEST}")
65
66
message (STATUS "ENABLE_TSAN: ${ENABLE_TSAN} " )
66
67
message (STATUS "ENABLE_STATIC_ASAN : ${ENABLE_STATIC_ASAN} " )
67
68
message (STATUS "ENABLE_STATIC_UBSAN : ${ENABLE_STATIC_UBSAN} " )
68
-
69
-
70
- add_compile_options (-fno-strict-aliasing)
69
+ message (STATUS "ENABLE_WERROR: ${ENABLE_WERROR} " )
70
+ message (STATUS "ENABLE_STRICT_ALIASING: ${ENABLE_STRICT_ALIASING} " )
71
71
72
72
if (ENABLE_NATIVE)
73
73
message (STATUS "ENABLE_NATIVE is ${ENABLE_NATIVE} " )
@@ -275,6 +275,10 @@ if(ENABLE_WERROR)
275
275
add_compile_options (-Werror)
276
276
endif ()
277
277
278
+ if (NOT ENABLE_STRICT_ALIASING)
279
+ add_compile_options (-fno-strict-aliasing)
280
+ endif ()
281
+
278
282
include (CheckCXXCompilerFlag)
279
283
280
284
# TODO(dutor) Move all compiler-config-related operations to a separate file
0 commit comments