vcpkg/ports/expat/portfile.cmake

48 lines
1.7 KiB
CMake
Raw Normal View History

if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
2016-09-19 11:50:08 +08:00
include(vcpkg_common_functions)
2017-08-23 22:07:57 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libexpat/libexpat
2018-09-18 17:28:21 +08:00
REF R_2_2_6
SHA512 727fbd24041c9af71b32353448583a6d8b38ddf93b10c97510e847939c2ad2be9b40ff6e6e27b725bff277982c2fc96c75f19c4a3ac4a246133eb62870c963d8
2017-08-23 22:07:57 +08:00
HEAD_REF master)
2016-09-19 11:50:08 +08:00
2016-11-01 04:47:07 +08:00
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(EXPAT_LINKAGE ON)
else()
set(EXPAT_LINKAGE OFF)
endif()
2016-09-19 11:50:08 +08:00
vcpkg_configure_cmake(
2017-08-23 22:07:57 +08:00
SOURCE_PATH ${SOURCE_PATH}/expat
PREFER_NINJA
2016-09-19 11:50:08 +08:00
OPTIONS
-DBUILD_examples=OFF
-DBUILD_tests=OFF
-DBUILD_tools=OFF
2016-11-01 04:47:07 +08:00
-DBUILD_shared=${EXPAT_LINKAGE}
2016-09-19 11:50:08 +08:00
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
2017-08-23 22:07:57 +08:00
file(INSTALL ${SOURCE_PATH}/expat/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright)
2016-11-01 04:47:07 +08:00
vcpkg_copy_pdbs()
2017-08-25 03:45:00 +08:00
# CMake's FindExpat currently doesn't look for expatd.lib
if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/expatd.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/expatd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/expat.lib)
endif()
2017-08-25 03:45:00 +08:00
file(READ ${CURRENT_PACKAGES_DIR}/include/expat_external.h EXPAT_EXTERNAL_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "!defined(XML_STATIC)" "/* vcpkg static build !defined(XML_STATIC) */ 0" EXPAT_EXTERNAL_H "${EXPAT_EXTERNAL_H}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/expat_external.h "${EXPAT_EXTERNAL_H}")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat)