pineapple-src/externals/vcpkg/ports/uriparser/portfile.cmake

59 lines
1.7 KiB
CMake
Raw Normal View History

2022-07-23 03:01:36 +02:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO uriparser/uriparser
REF 1ebc4811d2a986d68142587eca2256837be0da85 # uriparser-0.9.6
SHA512 fda7a92afddf12362691718a220ff23363c9684d0f2b500362f7060abd04440a8baaad1cd3d3ba6ab7e94a16e29763ca67c415aa66c284102bea6b80a8058045
HEAD_REF master
)
if("tool" IN_LIST FEATURES)
set(URIPARSER_BUILD_TOOLS ON)
else()
set(URIPARSER_BUILD_TOOLS OFF)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DURIPARSER_BUILD_DOCS=OFF
-DURIPARSER_BUILD_TESTS=OFF
OPTIONS_DEBUG
-DURIPARSER_BUILD_TOOLS=OFF
OPTIONS_RELEASE
-DURIPARSER_BUILD_TOOLS=${URIPARSER_BUILD_TOOLS}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
if(URIPARSER_BUILD_TOOLS)
vcpkg_copy_tools(
TOOL_NAMES uriparse
AUTO_CLEAN
)
endif()
set(_package_version_re "#define[ ]+PACKAGE_VERSION[ ]+\"([0-9]+.[0-9]+.[0-9]+)\"")
file(STRINGS
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.h"
_package_version_define REGEX "${_package_version_re}"
)
string(REGEX REPLACE "${_package_version_re}" "\\1" _package_version ${_package_version_define})
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}-${_package_version})
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/uriparser/UriBase.h"
"defined(URI_STATIC_BUILD)"
"1 // defined(URI_STATIC_BUILD)"
)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_fixup_pkgconfig()