From fcff767a7f4e3bef9b712e5857c09188e0984659 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 3 Feb 2021 22:16:42 +0000 Subject: [PATCH] cmake(tbb): fix target_compile_definitions() with "UNKNOWN" target - https://gitlab.kitware.com/cmake/cmake/-/issues/19434 --- cmake/OpenCVDetectTBB.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVDetectTBB.cmake b/cmake/OpenCVDetectTBB.cmake index 794042f..cade0f8 100644 --- a/cmake/OpenCVDetectTBB.cmake +++ b/cmake/OpenCVDetectTBB.cmake @@ -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) -- 2.7.4