2018-03-11 23:41:51 -07:00
_find_package ( ${ ARGS } )
2018-04-03 15:59:54 -07:00
if ( LibXml2_FOUND )
2021-07-16 02:19:56 +02: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-11 23:41:51 -07:00
find_package ( LibLZMA )
2019-03-16 06:29:08 +08:00
find_package ( ZLIB )
2021-08-13 22:57:28 +02:00
find_package ( Iconv )
2020-05-18 19:40:18 +02:00
include ( SelectLibraryConfigurations )
2021-07-22 00:40:01 +02: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 02:19:56 +02: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-13 22:57:28 +02:00
if ( Iconv_LIBRARIES )
list ( APPEND LIBXML2_LIBRARIES ${ Iconv_LIBRARIES } )
endif ( )
2021-07-16 02:19:56 +02: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-01 17:49:04 +01:00
endif ( )
2021-07-16 02:19:56 +02:00
cmake_policy ( PUSH )
cmake_policy ( SET CMP0079 NEW )
2020-05-18 19:40:18 +02:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
list ( APPEND LIBXML2_LIBRARIES m )
2021-07-16 02:19:56 +02:00
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 ( )
2020-11-17 18:18:59 +01:00
endif ( )
2021-07-16 02:19:56 +02:00
if ( TARGET LibXml2::LibXml2 )
2021-08-13 22:57:28 +02:00
target_link_libraries ( LibXml2::LibXml2 INTERFACE "liblzma::liblzma" "ZLIB::ZLIB" )
if ( TARGET Iconv::Iconv )
target_link_libraries ( LibXml2::LibXml2 INTERFACE "Iconv::Iconv" )
endif ( )
2018-04-03 15:59:54 -07:00
endif ( )
2021-07-16 02:19:56 +02:00
cmake_policy ( POP )
2018-03-11 23:41:51 -07:00
endif ( )