@@ -50,6 +50,15 @@ IF(MSVC)
50
50
OPTION ( STATIC_CRT "Link the static CRT libraries" ON )
51
51
ENDIF ()
52
52
53
+ # This variable will contain the libraries we need to put into
54
+ # libgit2.pc's Requires.private. That is, what we're linking to or
55
+ # what someone who's statically linking us needs to link to.
56
+ SET (LIBGIT2_PC_REQUIRES "" )
57
+ # This will be set later if we use the system's http-parser library or
58
+ # use iconv (OSX) and will be written to the Libs.private field in the
59
+ # pc file.
60
+ SET (LIBGIT2_PC_LIBS "" )
61
+
53
62
# Installation paths
54
63
#
55
64
SET (BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to." )
@@ -68,6 +77,7 @@ FUNCTION(TARGET_OS_LIBRARIES target)
68
77
IF (USE_ICONV )
69
78
TARGET_LINK_LIBRARIES (${target} iconv )
70
79
ADD_DEFINITIONS (-DGIT_USE_ICONV )
80
+ SET (LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -liconv" )
71
81
ENDIF ()
72
82
73
83
IF (THREADSAFE )
@@ -119,6 +129,7 @@ ELSE ()
119
129
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2 )
120
130
INCLUDE_DIRECTORIES (${HTTP_PARSER_INCLUDE_DIRS} )
121
131
LINK_LIBRARIES (${HTTP_PARSER_LIBRARIES} )
132
+ SET (LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lhttp_parser" )
122
133
ELSE ()
123
134
MESSAGE ("http-parser was not found or is too old; using bundled 3rd-party sources." )
124
135
INCLUDE_DIRECTORIES (deps/http-parser )
@@ -132,6 +143,7 @@ IF (WIN32 AND NOT MINGW AND NOT SHA1_TYPE STREQUAL "builtin")
132
143
FILE (GLOB SRC_SHA1 src/hash/hash_win32.c )
133
144
ELSEIF (OPENSSL_FOUND AND NOT SHA1_TYPE STREQUAL "builtin" )
134
145
ADD_DEFINITIONS (-DOPENSSL_SHA1 )
146
+ SET (LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl" )
135
147
ELSE ()
136
148
FILE (GLOB SRC_SHA1 src/hash/hash_generic.c )
137
149
ENDIF ()
@@ -154,6 +166,7 @@ FIND_PACKAGE(ZLIB QUIET)
154
166
IF (ZLIB_FOUND )
155
167
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS} )
156
168
LINK_LIBRARIES (${ZLIB_LIBRARIES} )
169
+ SET (LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib" )
157
170
# Fake the message CMake would have shown
158
171
MESSAGE ("-- Found zlib: ${ZLIB_LIBRARY} " )
159
172
ELSE ()
@@ -169,6 +182,7 @@ ENDIF()
169
182
IF (LIBSSH2_FOUND )
170
183
ADD_DEFINITIONS (-DGIT_SSH )
171
184
INCLUDE_DIRECTORIES (${LIBSSH2_INCLUDE_DIR} )
185
+ SET (LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2" )
172
186
SET (SSH_LIBRARIES ${LIBSSH2_LIBRARIES} )
173
187
ENDIF ()
174
188
0 commit comments