cmake(tbb): fix target_compile_definitions() with "UNKNOWN" target

- https://gitlab.kitware.com/cmake/cmake/-/issues/19434
This commit is contained in:
Alexander Alekhin 2021-02-03 22:16:42 +00:00
parent eced4dd023
commit fcff767a7f

View File

@ -85,7 +85,11 @@ function(ocv_tbb_env_guess _found)
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")
if(NOT (CMAKE_VERSION VERSION_LESS "3.16.0")) # https://gitlab.kitware.com/cmake/cmake/-/issues/19434
target_compile_definitions(tbb INTERFACE "__TBB_NO_IMPLICIT_LINKAGE=1")
else()
set_target_properties(tbb PROPERTIES INTERFACE_COMPILE_OPTIONS "__TBB_NO_IMPLICIT_LINKAGE=1")
endif()
endif()
message(STATUS "Found TBB (env): ${TBB_ENV_LIB}")
set(${_found} TRUE PARENT_SCOPE)