summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Cooper <jason@lakedaemon.net>2017-06-21 20:02:48 +0000
committerPatrick Steinhardt <ps@pks.im>2017-06-22 12:04:20 +0200
commit845f661df4492bc2bc2f4e7ed541ee098659a3d1 (patch)
treed84f61ff142f6e1524199e1928908e3c0547644b
parentfa94875295bbd7a4afa0f7724e77dcff8cd3adab (diff)
downloadlibgit2-845f661df4492bc2bc2f4e7ed541ee098659a3d1.tar.gz
cmake: Permit disabling external http-parser
When attempting to build libgit2 as an isolated static lib, CMake gleefully attempts to use the system http-parser. This is typically seen on Linux systems which install header files with every package, such as Gentoo. Allow developers to forcibly disable using the system http-parser with the config switch USE_EXT_HTTP_PARSER. Defaults to ON to maintain previous behavior. Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--CMakeLists.txt5
1 files changed, 3 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4783e3ef9..da7acfbcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
OPTION( VALGRIND "Configure build for valgrind" OFF )
OPTION( CURL "Use curl for HTTP if available" ON)
+OPTION( USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
IF(DEBUG_POOL)
@@ -329,12 +330,12 @@ ENDIF()
# Optional external dependency: http-parser
FIND_PACKAGE(HTTP_Parser)
-IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
+IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
ELSE()
- MESSAGE(STATUS "http-parser version 2 was not found; using bundled 3rd-party sources.")
+ MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
INCLUDE_DIRECTORIES(deps/http-parser)
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
ENDIF()