1
0

portfile.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. file(READ ${CMAKE_CURRENT_LIST_DIR}/vcpkg.json vcpkg_json)
  2. string(JSON VERSION GET "${vcpkg_json}" "version")
  3. vcpkg_from_github(
  4. OUT_SOURCE_PATH SOURCE_PATH
  5. REPO libexpat/libexpat
  6. REF R_2_4_9
  7. SHA512 6bf92516ce2642b2cdcbc586aaac0f706f125394fa428670f9b8b042a1f393e3b9dda1a24e58e6c8ad8b4ff3303cb5a8700628c6c04a881a06251c08be3759d3
  8. HEAD_REF master
  9. PATCHES
  10. "pkgconfig_fix.patch" # https://github.com/libexpat/libexpat/pull/656
  11. "mingw_static_fix.patch" # https://github.com/libexpat/libexpat/pull/658
  12. )
  13. string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" EXPAT_LINKAGE)
  14. vcpkg_cmake_configure(
  15. SOURCE_PATH "${SOURCE_PATH}/expat"
  16. OPTIONS
  17. -DEXPAT_BUILD_EXAMPLES=OFF
  18. -DEXPAT_BUILD_TESTS=OFF
  19. -DEXPAT_BUILD_TOOLS=OFF
  20. -DEXPAT_BUILD_DOCS=OFF
  21. -DEXPAT_SHARED_LIBS=${EXPAT_LINKAGE}
  22. -DEXPAT_BUILD_PKGCONFIG=ON
  23. -DEXPAT_CHAR_TYPE=wchar_t
  24. )
  25. vcpkg_cmake_install()
  26. vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/expat-${VERSION}")
  27. vcpkg_fixup_pkgconfig()
  28. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
  29. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
  30. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc")
  31. if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
  32. vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/expat_external.h"
  33. "! defined(XML_STATIC)"
  34. "/* vcpkg static build ! defined(XML_STATIC) */ 0"
  35. )
  36. endif()
  37. vcpkg_copy_pdbs()
  38. file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
  39. file(INSTALL "${SOURCE_PATH}/expat/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)