vcpkg/ports/opencv4/0010-fix-interface_link_libraries.patch

23 lines
1011 B
Diff

diff --git a/modules/videoio/cmake/init.cmake b/modules/videoio/cmake/init.cmake
index 1efef12..81d5d9f 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()