diff --git a/CMakeLists.txt b/CMakeLists.txt index 20aec17e..911f3096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,15 +40,16 @@ add_cxx_compiler_flag(-pedantic-errors) add_cxx_compiler_flag(-Wshorten-64-to-32) add_cxx_compiler_flag(-Wfloat-equal) add_cxx_compiler_flag(-Wzero-as-null-pointer-constant) +add_cxx_compiler_flag(-fstrict-aliasing) +if (HAVE_CXX_FLAG_FSTRICT_ALIASING) + add_cxx_compiler_flag(-Wstrict-aliasing) +endif() add_cxx_compiler_flag(-Wthread-safety) if (HAVE_WTHREAD_SAFETY) add_definitions(-DHAVE_WTHREAD_SAFETY) cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) endif() -# Release flags -add_cxx_compiler_flag(-fno-strict-aliasing RELEASE) - # Link time optimisation if (BENCHMARK_ENABLE_LTO) add_cxx_compiler_flag(-flto)