Merge pull request #18658 from JackBoosY:master

* Fix cmake configure error

* judge the cmake version

* Add comments
This commit is contained in:
Jack·Boos·Yu 2020-10-29 06:50:25 -07:00 committed by GitHub
parent d9a62c42e5
commit 56d2b7137c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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