summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2017-12-10 02:19:34 +0000
committerEtienne Samson <samson.etienne@gmail.com>2017-12-14 22:18:44 +0100
commit4969a6721b56d961f7d2cc925856dc07d0833c6e (patch)
tree39a62acb6b91db00bc6934307edb9c7d013b0bb9
parent1bf173c33a217a2e4766d8c144b7935010dfa7d6 (diff)
downloadlibgit2-4969a6721b56d961f7d2cc925856dc07d0833c6e.tar.gz
cmake: create a dummy file for Xcode
Otherwise Xcode will happily not-link our git2 target, resulting in a "missing file" error when building eg. examples
-rw-r--r--src/CMakeLists.txt12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e456ab725..ac519471d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,11 +3,6 @@ IF(DEBUG_POOL)
ENDIF()
ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator")
-# Add the features.h file as a dummy. This is required for Xcode
-# to successfully build the libgit2 library when using only
-# object libraries.
-SET(LIBGIT2_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/git2/sys/features.h")
-
# This variable will contain the libraries we need to put into
# libgit2.pc's Requires.private. That is, what we're linking to or
# what someone who's statically linking us needs to link to.
@@ -404,6 +399,13 @@ SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE)
+IF(XCODE_VERSION)
+ # This is required for Xcode to actually link the libgit2 library
+ # when using only object libraries.
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
+ LIST(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
+ENDIF()
+
# Compile and link libgit2
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})