cmake: workaround oneTBB build issues with MSVC

This commit is contained in:
Alexander Alekhin 2021-02-02 15:03:27 +00:00
parent 6be9496d73
commit eced4dd023

View File

@ -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()