vcpkg/ports/expat/portfile.cmake
JonLiu1993 3a98608b80
[expat] Update to 2.4.1 (#17856)
* [expat] Update to 2.3.0

* update version

* [expat] Update to 2.4.1

* update version

* add pkgconfig.patch

* update version

* revert pkgconfig.patch

* update version

* revert patch format

* update version
2021-06-11 08:48:00 -07:00

51 lines
1.4 KiB
CMake

set (EX_VERSION 2.4.1)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libexpat/libexpat
REF a28238bdeebc087071777001245df1876a11f5ee #v2.4.1
SHA512 2c22f2dfab50644637a7777229849c91630ae8c50683df6ad6409d473690ce01b59ce9f98e66b0aeac8c650507f04edbb5d9738130c88b87bbc1adb7831c22a9
HEAD_REF master
PATCHES
pkgconfig.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(EXPAT_LINKAGE ON)
else()
set(EXPAT_LINKAGE OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/expat
PREFER_NINJA
OPTIONS
-DEXPAT_BUILD_EXAMPLES=OFF
-DEXPAT_BUILD_TESTS=OFF
-DEXPAT_BUILD_TOOLS=OFF
-DEXPAT_SHARED_LIBS=${EXPAT_LINKAGE}
-DEXPAT_BUILD_PKGCONFIG=ON
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/expat-${EX_VERSION})
vcpkg_fixup_pkgconfig()
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/expat_external.h
"! defined(XML_STATIC)"
"/* vcpkg static build ! defined(XML_STATIC) */ 0"
)
endif()
vcpkg_copy_pdbs()
#Handle copyright
file(INSTALL ${SOURCE_PATH}/expat/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})