vcpkg/ports/c-ares/portfile.cmake
Jack·Boos·Yu 383060ffb6
[many ports] Add vcpkg_fixup_pkgconfig (#19721)
* [many ports]Add vcpkg_fixup_pkgconfig

* version

* Update ports/libepoxy/vcpkg.json

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* Update versions/l-/libepoxy.json

* Update versions/l-/libepoxy.json

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2021-08-26 10:09:08 -07:00

45 lines
1.4 KiB
CMake

vcpkg_fail_port_install(ON_TARGET "uwp")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO c-ares/c-ares
REF cares-1_17_2
SHA512 1111f1e7eeb0e5d9e70d1a7c8566145d0a5e6e71b020f3fcaa02ecdf1931553ddeff83fdc152a1f9c5a780078e8afe3670164b631df56eecd2b638210cc59bb3
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DCARES_STATIC=${BUILD_STATIC}
-DCARES_SHARED=${BUILD_SHARED}
-DCARES_BUILD_TOOLS=OFF
-DCARES_BUILD_TESTS=OFF
-DCARES_BUILD_CONTAINER_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/c-ares)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/ares.h"
"#ifdef CARES_STATICLIB" "#if 1"
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static OR NOT VCPKG_TARGET_IS_WINDOWS)
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)