From 56d2b7137ccf5258f533db9db7b3d8e60084041c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Thu, 29 Oct 2020 06:50:25 -0700 Subject: [PATCH] Merge pull request #18658 from JackBoosY:master * Fix cmake configure error * judge the cmake version * Add comments --- modules/videoio/cmake/init.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/videoio/cmake/init.cmake b/modules/videoio/cmake/init.cmake index 1efef12c5e76..81d5d9fe8727 100644 --- a/modules/videoio/cmake/init.cmake +++ b/modules/videoio/cmake/init.cmake @@ -12,8 +12,16 @@ function(ocv_add_external_target name inc link def) set_target_properties(ocv.3rdparty.${name} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${inc}" INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${inc}" - INTERFACE_LINK_LIBRARIES "${link}" INTERFACE_COMPILE_DEFINITIONS "${def}") + # When cmake version is greater than or equal to 3.11, INTERFACE_LINK_LIBRARIES no longer applies to interface library + # See https://github.com/opencv/opencv/pull/18658 + if (CMAKE_VERSION VERSION_LESS 3.11) + set_target_properties(ocv.3rdparty.${name} PROPERTIES + INTERFACE_LINK_LIBRARIES "${link}") + else() + target_link_libraries(ocv.3rdparty.${name} INTERFACE ${link}) + endif() + # if(NOT BUILD_SHARED_LIBS) install(TARGETS ocv.3rdparty.${name} EXPORT OpenCVModules) endif()