diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index 24b6f6b791..93d9435237 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -212,7 +212,13 @@ else() endif() ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations) -string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + +# filter out flags that are not handled well by the TBB code +foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG) + string(REPLACE "-Werror=non-virtual-dtor" "" ${var} "${${var}}") + string(REPLACE "-fvisibility=hidden" "" ${var} "${${var}}") + string(REPLACE "-fvisibility-inlines-hidden" "" ${var} "${${var}}") +endforeach() if (WIN32) set(tbb_debug_postfix "_debug") # to fit pragmas in _windef.h inside TBB