Commit f2e5c092e630d205aec3b990a9024ab85705fdc6

Patrick Steinhardt 2018-04-27T15:31:43

cmake: remove now-useless LIBGIT2_LIBDIRS handling With the recent change of always resolving pkg-config libraries to their full path, we do not have to manage the LIBGIT2_LIBDIRS variable anymore. The only other remaining user of LIBGIT2_LIBDIRS is winhttp, which is a CMake-style library target and can thus be resolved by CMake automatically. Remove the variable to simplify our build system a bit.

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 99e2ba9..ca7515e 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,4 +1,3 @@
-LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
 INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
 
 FILE(GLOB_RECURSE SRC_EXAMPLE_GIT2 network/*.c network/*.h common.?)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cfbf22c..4cfb2d3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,7 +17,6 @@ SET(LIBGIT2_INCLUDES
 	"${libgit2_SOURCE_DIR}/src"
 	"${libgit2_SOURCE_DIR}/include")
 SET(LIBGIT2_LIBS "")
-SET(LIBGIT2_LIBDIRS "")
 
 # Installation paths
 #
@@ -109,7 +108,6 @@ IF (WIN32 AND WINHTTP)
 		ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
 		LIST(APPEND LIBGIT2_LIBS winhttp)
 		LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
-		LIST(APPEND LIBGIT2_LIBDIRS ${LIBWINHTTP_PATH})
 	ELSE()
 		LIST(APPEND LIBGIT2_LIBS "winhttp")
 		LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
@@ -124,7 +122,6 @@ ELSE ()
 	IF (CURL_FOUND)
 		SET(GIT_CURL 1)
 		LIST(APPEND LIBGIT2_INCLUDES ${CURL_INCLUDE_DIRS})
-		LIST(APPEND LIBGIT2_LIBDIRS ${CURL_LIBRARY_DIRS})
 		LIST(APPEND LIBGIT2_LIBS ${CURL_LIBRARIES})
 		LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
 	ENDIF()
@@ -287,7 +284,6 @@ IF (LIBSSH2_FOUND)
 	SET(GIT_SSH 1)
 	LIST(APPEND LIBGIT2_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
 	LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES})
-	LIST(APPEND LIBGIT2_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
 	LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
 
 	CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
@@ -402,7 +398,6 @@ ENDIF()
 SET(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE)
 SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
 SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
-SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE)
 
 IF(XCODE_VERSION)
 	# This is required for Xcode to actually link the libgit2 library
@@ -412,7 +407,6 @@ IF(XCODE_VERSION)
 ENDIF()
 
 # Compile and link libgit2
-LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
 ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
 TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
 
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e73e723..82bf6d0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -31,7 +31,6 @@ SET_SOURCE_FILES_PROPERTIES(
 	${CLAR_PATH}/clar.c
 	PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clar.suite)
 
-LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
 INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
 
 ADD_EXECUTABLE(libgit2_clar ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})