summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-01-03 13:09:21 +0000
committerGitHub <noreply@github.com>2018-01-03 13:09:21 +0000
commit30455a56506d3dc086cf8efb831d8b1513dd3027 (patch)
tree9cfd30268bc444f4b1a60bd335e35f09d312f702
parent4964aea07e22318bdcda1e30d1b6a6deecfc12da (diff)
parent4969a6721b56d961f7d2cc925856dc07d0833c6e (diff)
downloadlibgit2-30455a56506d3dc086cf8efb831d8b1513dd3027.tar.gz
Merge pull request #4439 from tiennou/fix/4352
cmake: create a dummy file for Xcode
-rw-r--r--src/CMakeLists.txt12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2c82d1f59..1f69d4f11 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})