mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-05 07:59:01 +08:00
82 lines
2.3 KiB
CMake
82 lines
2.3 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO libgit2/libgit2
|
|
REF v1.6.4
|
|
SHA512 fd73df91710f19b0d6c3765c37c7f529233196da91cf4d58028a8d3840244f11df44abafabd74a8ed1cbe4826d1afd6ff9f01316d183ace0924c65e7cf0eb8d5
|
|
HEAD_REF maint/v1.6
|
|
PATCHES
|
|
fix-configcmake.patch
|
|
)
|
|
|
|
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindPCRE.cmake")
|
|
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
|
|
|
|
set(REGEX_BACKEND OFF)
|
|
set(USE_HTTPS OFF)
|
|
|
|
function(set_regex_backend VALUE)
|
|
if(REGEX_BACKEND)
|
|
message(FATAL_ERROR "Only one regex backend (pcre,pcre2) is allowed")
|
|
endif()
|
|
set(REGEX_BACKEND ${VALUE} PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
function(set_tls_backend VALUE)
|
|
if(USE_HTTPS)
|
|
message(FATAL_ERROR "Only one TLS backend (openssl,winhttp,sectransp,mbedtls) is allowed")
|
|
endif()
|
|
set(USE_HTTPS ${VALUE} PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
if("openssl" IN_LIST FEATURES)
|
|
list(APPEND GIT_OPTIONS "-DGIT_OPENSSL=1")
|
|
endif()
|
|
|
|
foreach(GIT2_FEATURE ${FEATURES})
|
|
if(GIT2_FEATURE STREQUAL "pcre")
|
|
set_regex_backend("pcre")
|
|
elseif(GIT2_FEATURE STREQUAL "pcre2")
|
|
set_regex_backend("pcre2")
|
|
elseif(GIT2_FEATURE STREQUAL "openssl")
|
|
set_tls_backend("OpenSSL")
|
|
elseif(GIT2_FEATURE STREQUAL "winhttp")
|
|
set_tls_backend("WinHTTP")
|
|
elseif(GIT2_FEATURE STREQUAL "sectransp")
|
|
set_tls_backend("SecureTransport")
|
|
elseif(GIT2_FEATURE STREQUAL "mbedtls")
|
|
set_tls_backend("mbedTLS")
|
|
endif()
|
|
endforeach()
|
|
|
|
if(NOT REGEX_BACKEND)
|
|
message(FATAL_ERROR "Must choose pcre or pcre2 regex backend")
|
|
endif()
|
|
|
|
vcpkg_check_features(
|
|
OUT_FEATURE_OPTIONS GIT2_FEATURES
|
|
FEATURES
|
|
ssh USE_SSH
|
|
)
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS
|
|
-DBUILD_TESTS=OFF
|
|
-DUSE_HTTP_PARSER=system
|
|
-DUSE_HTTPS=${USE_HTTPS}
|
|
-DREGEX_BACKEND=${REGEX_BACKEND}
|
|
-DSTATIC_CRT=${STATIC_CRT}
|
|
-DBUILD_CLI=OFF
|
|
${GIT2_FEATURES}
|
|
${GIT_OPTIONS}
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-git2 CONFIG_PATH share/unofficial-git2)
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|