Skip to content

Commit 236a690

Browse files
committed
Allow Windows with WinHTTP to use external http-parser
1 parent ae5838f commit 236a690

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

CMakeLists.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,21 @@ IF (WIN32 AND EMBED_SSH_PATH)
235235
ADD_DEFINITIONS(-DGIT_SSH)
236236
ENDIF()
237237

238-
IF (WIN32 AND WINHTTP)
239-
ADD_DEFINITIONS(-DGIT_WINHTTP)
238+
239+
FIND_PACKAGE(HTTP_Parser)
240+
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
241+
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
242+
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
243+
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
244+
ELSE()
245+
MESSAGE(STATUS "http-parser was not found or is too old; using bundled 3rd-party sources.")
240246
INCLUDE_DIRECTORIES(deps/http-parser)
241247
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
248+
ENDIF()
249+
250+
251+
IF (WIN32 AND WINHTTP)
252+
ADD_DEFINITIONS(-DGIT_WINHTTP)
242253

243254
# Since MinGW does not come with headers or an import library for winhttp,
244255
# we have to include a private header and generate our own import library
@@ -291,17 +302,6 @@ ELSE ()
291302
LINK_LIBRARIES(${CURL_LIBRARIES})
292303
LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
293304
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()
305305
ENDIF()
306306

307307
# Specify sha1 implementation

0 commit comments

Comments
 (0)