[c-ares] Fix definition on static build, add options to disable tools and tests (#17230)

* [c-ares] Fix definition on static build, add options to disable tools and tests

* update version record
This commit is contained in:
Jack·Boos·Yu 2021-04-13 01:24:05 +08:00 committed by GitHub
parent d01ed0ebd9
commit bc4cca6735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 31 deletions

View File

@ -1,5 +0,0 @@
Source: c-ares
Version: 1.17.1
Homepage: https://github.com/c-ares/c-ares
Description: A C library for asynchronous DNS requests
Supports: !uwp

View File

@ -8,43 +8,35 @@ vcpkg_from_github(
HEAD_REF master
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(CARES_STATIC 1)
set(CARES_SHARED 0)
else()
set(CARES_STATIC 0)
set(CARES_SHARED 1)
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DCARES_STATIC=${CARES_STATIC}
-DCARES_SHARED=${CARES_SHARED}
-DCARES_STATIC=${BUILD_STATIC}
-DCARES_SHARED=${BUILD_SHARED}
-DCARES_BUILD_TOOLS=OFF
-DCARES_BUILD_TESTS=OFF
-DCARES_BUILD_CONTAINER_TESTS=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/c-ares)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
else()
file(GLOB EXE_FILES
"${CURRENT_PACKAGES_DIR}/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
)
if (EXE_FILES)
file(REMOVE ${EXE_FILES})
endif()
endif()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/ares.h
"#ifdef CARES_STATICLIB" "#if 1"
)
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")
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

8
ports/c-ares/vcpkg.json Normal file
View File

@ -0,0 +1,8 @@
{
"name": "c-ares",
"version": "1.17.1",
"port-version": 1,
"description": "A C library for asynchronous DNS requests",
"homepage": "https://github.com/c-ares/c-ares",
"supports": "!uwp"
}

View File

@ -1058,7 +1058,7 @@
},
"c-ares": {
"baseline": "1.17.1",
"port-version": 0
"port-version": 1
},
"c4core": {
"baseline": "2020-04-12",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1e8d84e28abdb8437a2665651b4359da40a3333f",
"version": "1.17.1",
"port-version": 1
},
{
"git-tree": "a35b0a23f91ec79cecdcb83c82840f7305dbd709",
"version-string": "1.17.1",