summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-06-11 22:03:29 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-06-13 21:24:11 +0100
commitfb529a01bf1fe7cd577069e03007c693fba22392 (patch)
tree6180fe8106e65b2cbc21c7b1c42734906f4da5ad /src
parent1bbdec69bef50208f77f0c4cbac7c6b56c35973f (diff)
downloadlibgit2-ethomson/urlparse_empty_port.tar.gz
http-parser: use our bundled http-parser by defaultethomson/urlparse_empty_port
Our bundled http-parser includes bugfixes, therefore we should prefer our http-parser until such time as we can identify that the system http-parser has these bugfixes (using a version check). Since these bugs are - at present - minor, retain the ability for users to force that they want to use the system http-parser anyway. This does change the cmake specification so that people _must_ opt-in to the new behavior knowingly.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 647bb097a..5a0cf347c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -340,12 +340,17 @@ ELSE()
ENDIF()
# Optional external dependency: http-parser
-FIND_PACKAGE(HTTP_Parser)
-IF (USE_EXT_HTTP_PARSER AND 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")
+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")