summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-09-05 13:24:07 +0200
committerPatrick Steinhardt <ps@pks.im>2016-09-05 13:24:07 +0200
commit528b2f7df81348c2e7b4e1f63189ba958f8e14a3 (patch)
tree24475d3a7a991f0172ccb8f79b596e83dcd7a875
parenta08e88259fe7ef3d7514a4774acd6eec5a6a2ca7 (diff)
downloadlibgit2-528b2f7df81348c2e7b4e1f63189ba958f8e14a3.tar.gz
cmake: add curl library path
The `PKG_CHECK_MODULES` function searches a pkg-config module and then proceeds to set various variables containing information on how to link to the library. In contrast to the `FIND_PACKAGE` function, the library path set by `PKG_CHECK_MODULES` will not necessarily contain linking instructions with a complete path to the library, though. So when a library is not installed in a standard location, the linker might later fail due to being unable to locate it. While we already honor this when configuring libssh2 by adding `LIBSSH2_LIBRARY_DIRS` to the link directories, we fail to do so for libcurl, preventing us to build libgit2 on e.g. FreeBSD. Fix the issue by adding the curl library directory to the linker search path.
-rw-r--r--CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93a9e47c1..635842f25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,6 +286,7 @@ ELSE ()
IF (CURL_FOUND)
ADD_DEFINITIONS(-DGIT_CURL)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
+ LINK_DIRECTORIES(${CURL_LIBRARY_DIRS})
LINK_LIBRARIES(${CURL_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
ENDIF()