mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-06 22:07:19 +02:00
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
From: Jakub Jirutka <jakub@jirutka.cz>
|
|
Date: Mon, 11 Apr 2017 3:23:00 +0200
|
|
Subject: [PATCH] Build both static and dynamic library
|
|
|
|
This is very hack-ish, it makes option BUILD_SHARED_LIBS unusable.
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -39,7 +39,6 @@
|
|
# Build options
|
|
#
|
|
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
|
|
-OPTION( BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON )
|
|
OPTION( THREADSAFE "Build libgit2 as threadsafe" ON )
|
|
OPTION( BUILD_CLAR "Build Tests using the Clar suite" ON )
|
|
OPTION( BUILD_EXAMPLES "Build library usage example apps" OFF )
|
|
@@ -58,6 +57,8 @@
|
|
OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
|
|
OPTION( ENABLE_WERROR "Enable compilation with -Werror" OFF )
|
|
OPTION( USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF )
|
|
+
|
|
+SET( BUILD_SHARED_LIBS ON )
|
|
|
|
IF (UNIX AND NOT APPLE)
|
|
OPTION( ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF )
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -415,9 +415,12 @@
|
|
|
|
# Compile and link libgit2
|
|
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
|
|
-ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
|
|
+ADD_LIBRARY(git2 SHARED ${WIN_RC} ${LIBGIT2_OBJECTS})
|
|
TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
|
|
|
|
+ADD_LIBRARY(git2_static STATIC ${WIN_RC} ${LIBGIT2_OBJECTS})
|
|
+SET_TARGET_PROPERTIES(git2_static PROPERTIES OUTPUT_NAME git2 CLEAN_DIRECT_OUTPUT 1)
|
|
+
|
|
SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
|
|
SET_TARGET_PROPERTIES(git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
|
|
SET_TARGET_PROPERTIES(git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
|
|
@@ -453,7 +457,7 @@
|
|
ENDIF ()
|
|
|
|
# Install
|
|
-INSTALL(TARGETS git2
|
|
+INSTALL(TARGETS git2 git2_static
|
|
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|