vcpkg/ports/libxml2/vcpkg-cmake-wrapper.cmake
Stefano Sinigardi 801f40c688
[OpenCV] update to v4.5.3 and to v3.4.15 (#18827)
* [OpenCV] update to v4.5.3 and to v3.4.15

* [OpenCV] update refs

* [libxml2] add missing find_dependency(Iconv)
[libiconv] update cmake wrapper

* [libiconv] fix hints

* [opencv4] do not require cudnn if cuda enabled

* [opencv] update refs

* [OpenCV] increase CI coverage even more

* [vcpkg-ci-opencv] trying to restore x64-uwp ci tests

* restore previous patches to avoid unnecessary modifications

* [OpenCV] fix refs

* [OpenCV] fix CMake Warning related to protobuf dependency

* [OpenCV] fix refs

* [libxml2] fix references

* [libxml2] restore previous cmake wrapper, new one is broken

* [libxml2] fix references

* bump versions

* update refs

* [libxml2] Update the format for vcpkg-cmake-wrapper.cmake

* Update versions/l-/libxml2.json

* [libxml2] update port version

* [libxml2] update refs

* [OpenCV] fix refs

Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2021-08-13 13:57:28 -07:00

50 lines
2.5 KiB
CMake

_find_package(${ARGS})
if(LibXml2_FOUND)
list(APPEND LIBXML2_INCLUDE_DIRS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
list(APPEND LIBXML2_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") # This is wrong but downstream doesn't correctly use _DIR vs _DIRS variables
if(TARGET LibXml2::LibXml2)
target_include_directories(LibXml2::LibXml2 INTERFACE "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
endif()
endif()
if(LibXml2_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT ${ARGV0}_CONFIG)
find_package(LibLZMA)
find_package(ZLIB)
find_package(Iconv)
include(SelectLibraryConfigurations)
find_library(LIBXML2_LIBRARY_DEBUG NAMES xml2 libxml2 xml2s libxml2s xml2d libxml2d xml2sd libxml2sd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
find_library(LIBXML2_LIBRARY_RELEASE NAMES xml2 libxml2 xml2s libxml2s NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
unset(LIBXML2_LIBRARIES)
unset(LIBXML2_LIBRARY CACHE)
select_library_configurations(LIBXML2)
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES})
if(Iconv_LIBRARIES)
list(APPEND LIBXML2_LIBRARIES ${Iconv_LIBRARIES})
endif()
if(TARGET LibXml2::LibXml2 AND LIBXML2_LIBRARY_RELEASE)
set_target_properties(LibXml2::LibXml2 PROPERTIES IMPORTED_LOCATION_RELEASE "${LIBXML2_LIBRARY_RELEASE}")
endif()
if(TARGET LibXml2::LibXml2 AND LIBXML2_LIBRARY_DEBUG)
set_target_properties(LibXml2::LibXml2 PROPERTIES IMPORTED_LOCATION_DEBUG "${LIBXML2_LIBRARY_DEBUG}")
endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0079 NEW)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBXML2_LIBRARIES m)
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "m")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND LIBXML2_LIBRARIES ws2_32)
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "ws2_32")
endif()
endif()
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE "liblzma::liblzma" "ZLIB::ZLIB")
if(TARGET Iconv::Iconv)
target_link_libraries(LibXml2::LibXml2 INTERFACE "Iconv::Iconv")
endif()
endif()
cmake_policy(POP)
endif()