Skip to content

Commit 805b90a

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#4015 from staticfloat/sf/win_http_parser
Allow Windows with WinHTTP to use external http-parser
2 parents c9b9968 + e56e4c7 commit 805b90a

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

CMakeLists.txt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ ENDIF()
237237

238238
IF (WIN32 AND WINHTTP)
239239
ADD_DEFINITIONS(-DGIT_WINHTTP)
240-
INCLUDE_DIRECTORIES(deps/http-parser)
241-
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
242240

243241
# Since MinGW does not come with headers or an import library for winhttp,
244242
# we have to include a private header and generate our own import library
@@ -291,17 +289,6 @@ ELSE ()
291289
LINK_LIBRARIES(${CURL_LIBRARIES})
292290
LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
293291
ENDIF()
294-
295-
FIND_PACKAGE(HTTP_Parser)
296-
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
297-
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
298-
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
299-
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
300-
ELSE()
301-
MESSAGE(STATUS "http-parser was not found or is too old; using bundled 3rd-party sources.")
302-
INCLUDE_DIRECTORIES(deps/http-parser)
303-
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
304-
ENDIF()
305292
ENDIF()
306293

307294
# Specify sha1 implementation
@@ -332,6 +319,18 @@ IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
332319
SET(SRC_REGEX deps/regex/regex.c)
333320
ENDIF()
334321

322+
# Optional external dependency: http-parser
323+
FIND_PACKAGE(HTTP_Parser)
324+
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
325+
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
326+
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
327+
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
328+
ELSE()
329+
MESSAGE(STATUS "http-parser version 2 was not found; using bundled 3rd-party sources.")
330+
INCLUDE_DIRECTORIES(deps/http-parser)
331+
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
332+
ENDIF()
333+
335334
# Optional external dependency: zlib
336335
FIND_PACKAGE(ZLIB)
337336
IF (ZLIB_FOUND)

0 commit comments

Comments
 (0)