Commit 474c8cf8 by Carlos Martín Nieto

Really fix the pc file

It turns out that variables have function scope by default. Let's
really set -liconv and add a few libraries that were forgotten in
the previous commit.

We also need to special-case OSX, as they ship zlib but do not provide
a pkg-config file for it.
parent 3fcb1d83
...@@ -70,14 +70,16 @@ FUNCTION(TARGET_OS_LIBRARIES target) ...@@ -70,14 +70,16 @@ FUNCTION(TARGET_OS_LIBRARIES target)
TARGET_LINK_LIBRARIES(${target} ws2_32) TARGET_LINK_LIBRARIES(${target} ws2_32)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
TARGET_LINK_LIBRARIES(${target} socket nsl) TARGET_LINK_LIBRARIES(${target} socket nsl)
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lsocket -lnsl" PARENT_SCOPE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
TARGET_LINK_LIBRARIES(${target} rt) TARGET_LINK_LIBRARIES(${target} rt)
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE)
ENDIF() ENDIF()
IF(USE_ICONV) IF(USE_ICONV)
TARGET_LINK_LIBRARIES(${target} iconv) TARGET_LINK_LIBRARIES(${target} iconv)
ADD_DEFINITIONS(-DGIT_USE_ICONV) ADD_DEFINITIONS(-DGIT_USE_ICONV)
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -liconv") SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -liconv" PARENT_SCOPE)
ENDIF() ENDIF()
IF(THREADSAFE) IF(THREADSAFE)
...@@ -166,7 +168,11 @@ FIND_PACKAGE(ZLIB QUIET) ...@@ -166,7 +168,11 @@ FIND_PACKAGE(ZLIB QUIET)
IF (ZLIB_FOUND) IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
LINK_LIBRARIES(${ZLIB_LIBRARIES}) LINK_LIBRARIES(${ZLIB_LIBRARIES})
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib") IF(APPLE)
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lz")
ELSE()
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib")
ENDIF()
# Fake the message CMake would have shown # Fake the message CMake would have shown
MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}") MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}")
ELSE() ELSE()
......
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