diff options
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | thirdparty/md5/CMakeLists.txt | 7 | ||||
-rw-r--r-- | thirdparty/snappy/CMakeLists.txt | 3 |
3 files changed, 7 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bfb69ad9..78796a60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,6 +254,11 @@ else () # XXX: it's safer to use ssize_t everywhere instead of disabling warning add_compiler_flags (-Wno-sign-compare) # comparison between signed and unsigned integer expressions + # Disable strict aliasing assumptions. We generate a lot of C++ code, and + # it's not always easy to guarantee or spot when strict aliasing + # assumptions are violated. Above all, the benefit is not worth the risk. + add_compiler_flags ("-fno-strict-aliasing") + # No RTTI required #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") diff --git a/thirdparty/md5/CMakeLists.txt b/thirdparty/md5/CMakeLists.txt index 5f12ad79..c5da18a7 100644 --- a/thirdparty/md5/CMakeLists.txt +++ b/thirdparty/md5/CMakeLists.txt @@ -1,10 +1,3 @@ -include (CheckCCompilerFlag) - -check_c_compiler_flag ("-fno-strict-aliasing" C_COMPILER_FLAG_NO_STRICT_ALIASING) -if (C_COMPILER_FLAG_NO_STRICT_ALIASING) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing") -endif () - add_library (md5_bundled STATIC EXCLUDE_FROM_ALL md5.c ) diff --git a/thirdparty/snappy/CMakeLists.txt b/thirdparty/snappy/CMakeLists.txt index f0b0cf02..dbe8b706 100644 --- a/thirdparty/snappy/CMakeLists.txt +++ b/thirdparty/snappy/CMakeLists.txt @@ -5,7 +5,8 @@ add_definitions ( # Adjust warnings if (NOT MSVC) - add_definitions (-Wno-unused-function) + add_compiler_flags (-Wno-unused-function) + add_compiler_flags (-fstrict-aliasing) endif () add_convenience_library (snappy_bundled EXCLUDE_FROM_ALL |