2023-08-08 00:09:36 +08:00
|
|
|
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _c_ares_version "${VERSION}")
|
|
|
|
set(_c_ares_version_major "${CMAKE_MATCH_1}")
|
|
|
|
set(_c_ares_version_minor "${CMAKE_MATCH_2}")
|
|
|
|
set(_c_ares_version_patch "${CMAKE_MATCH_3}")
|
|
|
|
|
2017-05-11 06:08:52 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO c-ares/c-ares
|
2023-08-08 00:09:36 +08:00
|
|
|
REF "cares-${_c_ares_version_major}_${_c_ares_version_minor}_${_c_ares_version_patch}"
|
2024-04-16 01:09:54 +08:00
|
|
|
SHA512 6c2f98055792880abb298c9d8c4f20460fe33b7b247d450b33e9c4e87d58b32c8fce371084b4bde42f50508e957b3fa5c897b1a3dcdcd214506c2bad4fd90c66
|
2022-04-11 23:39:59 +08:00
|
|
|
HEAD_REF main
|
|
|
|
PATCHES
|
|
|
|
avoid-docs.patch
|
2017-05-11 06:08:52 +08:00
|
|
|
)
|
|
|
|
|
2021-04-13 01:24:05 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
|
2017-05-11 06:08:52 +08:00
|
|
|
|
2021-08-27 01:09:08 +08:00
|
|
|
vcpkg_cmake_configure(
|
2022-04-11 23:39:59 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2017-05-11 06:08:52 +08:00
|
|
|
OPTIONS
|
2021-04-13 01:24:05 +08:00
|
|
|
-DCARES_STATIC=${BUILD_STATIC}
|
|
|
|
-DCARES_SHARED=${BUILD_SHARED}
|
|
|
|
-DCARES_BUILD_TOOLS=OFF
|
|
|
|
-DCARES_BUILD_TESTS=OFF
|
|
|
|
-DCARES_BUILD_CONTAINER_TESTS=OFF
|
2017-05-11 06:08:52 +08:00
|
|
|
)
|
|
|
|
|
2021-08-27 01:09:08 +08:00
|
|
|
vcpkg_cmake_install()
|
2017-05-11 06:08:52 +08:00
|
|
|
|
2021-04-13 01:24:05 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2021-08-27 01:09:08 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/c-ares)
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
|
2022-04-28 09:59:20 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2021-08-27 01:09:08 +08:00
|
|
|
vcpkg_replace_string(
|
|
|
|
"${CURRENT_PACKAGES_DIR}/include/ares.h"
|
2024-02-06 09:02:49 +08:00
|
|
|
"# ifdef CARES_STATICLIB" "#if 1"
|
2017-06-10 06:39:32 +08:00
|
|
|
)
|
2021-08-03 07:55:47 +08:00
|
|
|
endif()
|
2017-05-11 06:08:52 +08:00
|
|
|
|
2022-04-28 09:59:20 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
|
2021-04-13 01:24:05 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") # Empty folders
|
|
|
|
endif()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
2017-05-11 06:08:52 +08:00
|
|
|
|
2022-04-28 09:59:20 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2021-04-13 01:24:05 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|