summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2013-10-23 22:49:52 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2013-10-23 22:49:52 +0200
commit474c8cf8329c96782942763712d372534e862f32 (patch)
treef750d6890cb569655237069add243aee6367719e
parent3fcb1d83112a8832c85fec4edb6a331a582d5fd5 (diff)
downloadlibgit2-474c8cf8329c96782942763712d372534e862f32.tar.gz
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.
-rw-r--r--CMakeLists.txt10
1 files changed, 8 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94418f85b..6010b63a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,14 +70,16 @@ FUNCTION(TARGET_OS_LIBRARIES target)
TARGET_LINK_LIBRARIES(${target} ws2_32)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
TARGET_LINK_LIBRARIES(${target} socket nsl)
+ SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lsocket -lnsl" PARENT_SCOPE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
TARGET_LINK_LIBRARIES(${target} rt)
+ SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE)
ENDIF()
IF(USE_ICONV)
TARGET_LINK_LIBRARIES(${target} 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()
IF(THREADSAFE)
@@ -166,7 +168,11 @@ FIND_PACKAGE(ZLIB QUIET)
IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
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
MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}")
ELSE()