mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 11:06:32 +00:00
cmake: refactor http_parser selection
Move http_parser selection into its own cmake module.
This commit is contained in:
19
cmake/SelectHTTPParser.cmake
Normal file
19
cmake/SelectHTTPParser.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# Optional external dependency: http-parser
|
||||
if(USE_HTTP_PARSER STREQUAL "system")
|
||||
find_package(HTTP_Parser)
|
||||
|
||||
if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
|
||||
add_feature_info(http-parser ON "http-parser support (system)")
|
||||
else()
|
||||
message(FATAL_ERROR "http-parser support was requested but not found")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
|
||||
add_subdirectory("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>")
|
||||
add_feature_info(http-parser ON "http-parser support (bundled)")
|
||||
endif()
|
||||
@@ -113,6 +113,8 @@ endif()
|
||||
|
||||
include(SelectHTTPSBackend)
|
||||
include(SelectHashes)
|
||||
include(SelectHTTPParser)
|
||||
|
||||
target_sources(git2internal PRIVATE ${SRC_SHA1})
|
||||
|
||||
# Specify regular expression implementation
|
||||
@@ -167,26 +169,6 @@ else()
|
||||
message(FATAL_ERROR "The REGEX_BACKEND option provided is not supported")
|
||||
endif()
|
||||
|
||||
# Optional external dependency: http-parser
|
||||
if(USE_HTTP_PARSER STREQUAL "system")
|
||||
find_package(HTTPParser)
|
||||
|
||||
if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
|
||||
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
|
||||
list(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
|
||||
add_feature_info(http-parser ON "http-parser support (system)")
|
||||
else()
|
||||
message(FATAL_ERROR "http-parser support was requested but not found")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
|
||||
add_subdirectory("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser")
|
||||
list(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>")
|
||||
add_feature_info(http-parser ON "http-parser support (bundled)")
|
||||
endif()
|
||||
|
||||
# Optional external dependency: zlib
|
||||
SanitizeBool(USE_BUNDLED_ZLIB)
|
||||
if(USE_BUNDLED_ZLIB STREQUAL ON)
|
||||
|
||||
Reference in New Issue
Block a user