From eced4dd023eeb70de894db659e18c29830dc0185 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 2 Feb 2021 15:03:27 +0000 Subject: [PATCH] cmake: workaround oneTBB build issues with MSVC --- cmake/OpenCVDetectTBB.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/OpenCVDetectTBB.cmake b/cmake/OpenCVDetectTBB.cmake index 1154bb1d0f..794042f614 100644 --- a/cmake/OpenCVDetectTBB.cmake +++ b/cmake/OpenCVDetectTBB.cmake @@ -82,6 +82,11 @@ function(ocv_tbb_env_guess _found) set_target_properties(tbb PROPERTIES INTERFACE_LINK_LIBRARIES "-L${_dir}") endif() ocv_tbb_read_version("${TBB_ENV_INCLUDE}" tbb) + if(NOT (TBB_INTERFACE_VERSION LESS 12000)) # >= 12000, oneTBB 2021+ + # avoid "defaultlib" requirement of tbb12.lib (we are using absolute path to 'tbb.lib' only) + # https://github.com/oneapi-src/oneTBB/blame/2dba2072869a189b9fdab3ffa431d3ea49059a19/include/oneapi/tbb/detail/_config.h#L334 + target_compile_definitions(tbb INTERFACE "__TBB_NO_IMPLICIT_LINKAGE=1") + endif() message(STATUS "Found TBB (env): ${TBB_ENV_LIB}") set(${_found} TRUE PARENT_SCOPE) endif()