Merge pull request #19447 from alalek:cmake_tbb_workaround_msvc

This commit is contained in:
Alexander Alekhin 2021-02-02 20:33:26 +00:00
commit 674ecc5581

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