2018-03-12 14:41:51 +08:00
_find_package ( ${ ARGS } )
2018-04-04 06:59:54 +08:00
if ( LibXml2_FOUND )
2021-07-16 08:19:56 +08:00
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 )
2018-03-12 14:41:51 +08:00
find_package ( LibLZMA )
2019-03-16 06:29:08 +08:00
find_package ( ZLIB )
2021-08-14 04:57:28 +08:00
find_package ( Iconv )
2020-05-19 01:40:18 +08:00
include ( SelectLibraryConfigurations )
2021-07-22 06:40:01 +08:00
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 )
2021-07-16 08:19:56 +08:00
unset ( LIBXML2_LIBRARIES )
unset ( LIBXML2_LIBRARY CACHE )
select_library_configurations ( LIBXML2 )
2019-03-16 06:29:08 +08:00
list ( APPEND LIBXML2_LIBRARIES ${ LIBLZMA_LIBRARIES } ${ ZLIB_LIBRARIES } )
2021-08-14 04:57:28 +08:00
if ( Iconv_LIBRARIES )
list ( APPEND LIBXML2_LIBRARIES ${ Iconv_LIBRARIES } )
endif ( )
2021-07-16 08:19:56 +08:00
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}" )
2021-07-02 00:49:04 +08:00
endif ( )
2021-07-16 08:19:56 +08:00
cmake_policy ( PUSH )
cmake_policy ( SET CMP0079 NEW )
2020-05-19 01:40:18 +08:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
list ( APPEND LIBXML2_LIBRARIES m )
2021-07-16 08:19:56 +08:00
if ( TARGET LibXml2::LibXml2 )
2021-09-03 04:21:52 +08:00
set_property ( TARGET LibXml2::LibXml2 APPEND PROPERTY INTERFACE_LINK_LIBRARIES "m" )
2021-07-16 08:19:56 +08:00
endif ( )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Windows" )
list ( APPEND LIBXML2_LIBRARIES ws2_32 )
if ( TARGET LibXml2::LibXml2 )
2021-09-03 04:21:52 +08:00
set_property ( TARGET LibXml2::LibXml2 APPEND PROPERTY INTERFACE_LINK_LIBRARIES "ws2_32" )
2021-07-16 08:19:56 +08:00
endif ( )
2020-11-18 01:18:59 +08:00
endif ( )
2021-07-16 08:19:56 +08:00
if ( TARGET LibXml2::LibXml2 )
2021-09-03 04:21:52 +08:00
set_property ( TARGET LibXml2::LibXml2 APPEND PROPERTY INTERFACE_LINK_LIBRARIES "liblzma::liblzma" "ZLIB::ZLIB" )
2021-08-14 04:57:28 +08:00
if ( TARGET Iconv::Iconv )
2021-09-03 04:21:52 +08:00
set_property ( TARGET LibXml2::LibXml2 APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Iconv::Iconv" )
2021-08-14 04:57:28 +08:00
endif ( )
2018-04-04 06:59:54 +08:00
endif ( )
2021-07-16 08:19:56 +08:00
cmake_policy ( POP )
2018-03-12 14:41:51 +08:00
endif ( )