Commit 1d9dd882 by Patrick Steinhardt

cmake: distinguish libgit2 objects and sources

Distinguish variables keeping track of our internal libgit2 sources and
the final objects which shall be linked into the library. This will ease
the transition to use object libraries for our bundled dependencies
instead of linking them in.
parent c17c3f8a
...@@ -2,6 +2,8 @@ IF(DEBUG_POOL) ...@@ -2,6 +2,8 @@ IF(DEBUG_POOL)
SET(GIT_DEBUG_POOL 1) SET(GIT_DEBUG_POOL 1)
ENDIF() ENDIF()
SET(LIBGIT2_OBJECTS "")
# This variable will contain the libraries we need to put into # This variable will contain the libraries we need to put into
# libgit2.pc's Requires.private. That is, what we're linking to or # libgit2.pc's Requires.private. That is, what we're linking to or
# what someone who's statically linking us needs to link to. # what someone who's statically linking us needs to link to.
...@@ -330,12 +332,12 @@ ENDIF() ...@@ -330,12 +332,12 @@ ENDIF()
CONFIGURE_FILE(features.h.in git2/sys/features.h) CONFIGURE_FILE(features.h.in git2/sys/features.h)
SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1}) SET(LIBGIT2_SOURCES ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1})
IF (CMAKE_VERSION VERSION_GREATER 2.8.7) IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
ADD_LIBRARY(git2internal OBJECT ${GIT2INTERNAL_OBJECTS}) ADD_LIBRARY(git2internal OBJECT ${LIBGIT2_SOURCES})
IDE_SPLIT_SOURCES(git2internal) IDE_SPLIT_SOURCES(git2internal)
SET(GIT2INTERNAL_OBJECTS $<TARGET_OBJECTS:git2internal>) LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>)
IF (${CMAKE_VERSION} VERSION_LESS 2.8.12) IF (${CMAKE_VERSION} VERSION_LESS 2.8.12)
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES}) INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
...@@ -346,16 +348,17 @@ IF (CMAKE_VERSION VERSION_GREATER 2.8.7) ...@@ -346,16 +348,17 @@ IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
ENDIF() ENDIF()
ELSE() ELSE()
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES}) INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
LIST(APPEND LIBGIT2_OBJECTS ${LIBGIT2_SOURCES})
ENDIF() ENDIF()
SET(GIT2INTERNAL_OBJECTS ${GIT2INTERNAL_OBJECTS} PARENT_SCOPE) SET(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE)
SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE) SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE) SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE) SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE)
# Compile and link libgit2 # Compile and link libgit2
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS}) LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
ADD_LIBRARY(git2 ${WIN_RC} ${GIT2INTERNAL_OBJECTS}) ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS}) TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
......
...@@ -33,7 +33,7 @@ SET_SOURCE_FILES_PROPERTIES( ...@@ -33,7 +33,7 @@ SET_SOURCE_FILES_PROPERTIES(
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS}) LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES}) INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
ADD_EXECUTABLE(libgit2_clar ${SRC_CLAR} ${SRC_TEST} ${GIT2INTERNAL_OBJECTS}) ADD_EXECUTABLE(libgit2_clar ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment