summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-09-06 07:38:48 +0200
committerPatrick Steinhardt <ps@pks.im>2017-09-20 15:26:26 +0200
commit8c19969a88c3b6e72564e812537b15cbc0fb4cc0 (patch)
treed108879404ca4980dd9d696631abb58a65ff00b8 /deps
parentd8d2f21e24933cddabf30f2d4a4ddf1be0072e56 (diff)
downloadlibgit2-8c19969a88c3b6e72564e812537b15cbc0fb4cc0.tar.gz
cmake: fix static linking for bundled deps
Our bundled deps are being built as simple static libraries which are then linked into the libgit2 library via `TARGET_LINK_LIBRARIES`. While this works for a dynamically built libgit2 library, using this function to link two static libraries does not have the expected outcome of merging those static libraries into one big library. This leads to symbols of our bundled deps being undefined in the resulting libgit2 archive. As we have bumped our minimum CMake version to 2.8.11, we can now easily make use of object libraries for our bundled dependencies. So build instructions are still self-contained inside of the dependency directories and the resulting object libraries can just be added to the LIBGIT2_OBJECTS list, which will cause them to be linked into the final resulting static library. This fixes the issue of undefined symbols.
Diffstat (limited to 'deps')
-rw-r--r--deps/http-parser/CMakeLists.txt2
-rw-r--r--deps/regex/CMakeLists.txt2
-rw-r--r--deps/zlib/CMakeLists.txt2
3 files changed, 3 insertions, 3 deletions
diff --git a/deps/http-parser/CMakeLists.txt b/deps/http-parser/CMakeLists.txt
index 9309841db..77d9de7a3 100644
--- a/deps/http-parser/CMakeLists.txt
+++ b/deps/http-parser/CMakeLists.txt
@@ -1,3 +1,3 @@
FILE(GLOB SRC_HTTP "*.c" "*.h")
-ADD_LIBRARY(http-parser STATIC ${SRC_HTTP})
+ADD_LIBRARY(http-parser OBJECT ${SRC_HTTP})
diff --git a/deps/regex/CMakeLists.txt b/deps/regex/CMakeLists.txt
index 6ef8a270f..141b54c4c 100644
--- a/deps/regex/CMakeLists.txt
+++ b/deps/regex/CMakeLists.txt
@@ -1,2 +1,2 @@
INCLUDE_DIRECTORIES(".")
-ADD_LIBRARY(regex STATIC "regex.c" "regex.h")
+ADD_LIBRARY(regex OBJECT "regex.c" "regex.h")
diff --git a/deps/zlib/CMakeLists.txt b/deps/zlib/CMakeLists.txt
index ca50d80c4..b0cb7f7ea 100644
--- a/deps/zlib/CMakeLists.txt
+++ b/deps/zlib/CMakeLists.txt
@@ -1,4 +1,4 @@
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
FILE(GLOB SRC_ZLIB "*.c" "*.h")
INCLUDE_DIRECTORIES(".")
-ADD_LIBRARY(zlib STATIC ${SRC_ZLIB})
+ADD_LIBRARY(zlib OBJECT ${SRC_ZLIB})