Skip to content

Commit 528b2f7

Browse files
committed
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.
1 parent a08e882 commit 528b2f7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ ELSE ()
286286
IF (CURL_FOUND)
287287
ADD_DEFINITIONS(-DGIT_CURL)
288288
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
289+
LINK_DIRECTORIES(${CURL_LIBRARY_DIRS})
289290
LINK_LIBRARIES(${CURL_LIBRARIES})
290291
LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
291292
ENDIF()

0 commit comments

Comments
 (0)