summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-06-28 13:25:09 +0200
committerPatrick Steinhardt <ps@pks.im>2017-08-16 07:12:38 +0200
commitb75145549704e7118f7802b42d1e72ac9ff69b6f (patch)
treedadddd9a5b2cc6c4afd15835a20ad9126a30f27e
parent9e449e521456227477458999817c85bde00f0a0f (diff)
downloadlibgit2-b75145549704e7118f7802b42d1e72ac9ff69b6f.tar.gz
cmake: move http-parser build instructions into subdirectory
Extract code required to build the http-parser library into its own CMakeLists.txt, which is included as required.
-rw-r--r--CMakeLists.txt5
-rw-r--r--deps/http-parser/CMakeLists.txt3
2 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1458bb893..44ba55b2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -466,8 +466,9 @@ IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUA
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
ELSE()
MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
+ ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/deps/http-parser" "${CMAKE_BINARY_DIR}/deps/http-parser")
LIST(APPEND LIBGIT2_INCLUDES "${CMAKE_SOURCE_DIR}/deps/http-parser")
- FILE(GLOB SRC_HTTP "${CMAKE_SOURCE_DIR}/deps/http-parser/*.c" "${CMAKE_SOURCE_DIR}/deps/http-parser/*.h")
+ LIST(APPEND LIBGIT2_LIBS http-parser)
ENDIF()
# Optional external dependency: zlib
@@ -600,7 +601,7 @@ ENDIF()
CONFIGURE_FILE(src/features.h.in git2/sys/features.h)
-SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_SSH} ${SRC_SHA1})
+SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_SSH} ${SRC_SHA1})
LIST(APPEND LIBGIT2_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include")
diff --git a/deps/http-parser/CMakeLists.txt b/deps/http-parser/CMakeLists.txt
new file mode 100644
index 000000000..9309841db
--- /dev/null
+++ b/deps/http-parser/CMakeLists.txt
@@ -0,0 +1,3 @@
+FILE(GLOB SRC_HTTP "*.c" "*.h")
+
+ADD_LIBRARY(http-parser STATIC ${SRC_HTTP})