diff --git a/CMakeLists.txt b/CMakeLists.txt index 53cb659a5ca0902bd379c53f5705022ae1e9ccf0..48f8616d20d08033970629fd83dde0e9765443b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,13 @@ endfunction() if (CMAKE_COMPILER_IS_GNUCXX) get_compiler_version(_GCC_VERSION) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + if (_GCC_VERSION MATCHES "44") + # gcc 4.4. is very strict about aliasing rules. the shared_count + # implementation that is used boost's shared_ptr violates these rules. To + # silence the warnings and prevent miscompiles, enable + # -fno-strict-aliasing + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") + endif() if (APPLE AND NOT _GCC_VERSION MATCHES "42") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") endif()