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 )
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 )
2020-07-03 02:00:28 +08:00
find_library ( ICONV_LIBRARY_DEBUG NAMES iconvd libiconvd iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH )
find_library ( ICONV_LIBRARY_RELEASE NAMES iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH )
2020-05-19 01:40:18 +08:00
find_library ( ICONV_LIBRARY_RELEASE NAMES iconv libiconv NAMES_PER_DIR PATH_SUFFIXES lib )
2020-07-03 02:00:28 +08:00
find_library ( CHARSET_LIBRARY_DEBUG NAMES charsetd libcharsetd charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH )
find_library ( CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH )
2020-05-19 01:40:18 +08:00
find_library ( CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib )
2021-07-16 08:19:56 +08:00
unset ( LIBXML2_LIBRARIES )
unset ( LIBXML2_LIBRARY CACHE )
select_library_configurations ( LIBXML2 )
2020-05-19 01:40:18 +08:00
select_library_configurations ( ICONV )
select_library_configurations ( CHARSET )
2019-03-16 06:29:08 +08:00
list ( APPEND LIBXML2_LIBRARIES ${ LIBLZMA_LIBRARIES } ${ ZLIB_LIBRARIES } )
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 )
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-18 01:18:59 +08:00
endif ( )
if ( ICONV_LIBRARIES )
list ( APPEND LIBXML2_LIBRARIES ${ ICONV_LIBRARIES } )
if ( TARGET LibXml2::LibXml2 )
2021-07-22 06:40:01 +08:00
target_link_libraries ( LibXml2::LibXml2 INTERFACE ${ ICONV_LIBRARIES } )
2020-11-18 01:18:59 +08:00
endif ( )
endif ( )
if ( CHARSET_LIBRARIES )
list ( APPEND LIBXML2_LIBRARIES ${ CHARSET_LIBRARIES } )
2020-01-16 02:33:50 +08:00
if ( TARGET LibXml2::LibXml2 )
2020-11-18 01:18:59 +08:00
target_link_libraries ( LibXml2::LibXml2 INTERFACE ${ CHARSET_LIBRARIES } )
2020-01-16 02:33:50 +08:00
endif ( )
2020-05-19 01:40:18 +08:00
endif ( )
2021-07-16 08:19:56 +08:00
if ( TARGET LibXml2::LibXml2 )
target_link_libraries ( LibXml2::LibXml2 INTERFACE ${ LIBLZMA_LIBRARIES } ${ ZLIB_LIBRARIES } )
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 ( )