CMake: simplify code in HandleFindGit2

Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
This commit is contained in:
Rolf Eike Beer 2019-03-19 22:39:53 +01:00 committed by Dirk Hohndel
parent c94e77d3dc
commit c1f88ddd69

View file

@ -16,22 +16,22 @@ else()
include_directories(${LIBGIT2_INCLUDE_DIR}) include_directories(${LIBGIT2_INCLUDE_DIR})
if(FORCE_LIBSSH) if(FORCE_LIBSSH)
find_package(Libssh2 QUIET CONFIG) find_package(Libssh2 QUIET CONFIG)
if ("${LIBSSH2_VERSION}" STRLESS "1.7" AND "${LIBSSH2_VERSION}" STRGREATER "1.6.1") if (LIBSSH2_VERSION VERSION_LESS "1.7" AND LIBSSH2_VERSION VERSION_GREATER "1.6.1")
set(LIBSSH2_LIBRARIES Libssh2::libssh2) set(LIBSSH2_LIBRARIES Libssh2::libssh2)
endif() endif()
# at least on my Mac I get the mixed case variable instead... # at least on my Mac I get the mixed case variable instead...
if(Libssh2_FOUND) if(Libssh2_FOUND)
set(LIBSSH2_FOUND ${Libssh2_FOUND}) set(LIBSSH2_FOUND ${Libssh2_FOUND})
endif() endif()
if(!LIBSSH2_FOUND OR "${LIBSSH2_FOUND}" STREQUAL "") if(NOT LIBSSH2_FOUND)
pkg_config_library(LIBSSH2 libssh2 REQUIRED) pkg_config_library(LIBSSH2 libssh2 REQUIRED)
endif() endif()
endif() endif()
find_package(libcurl QUIET) find_package(libcurl QUIET)
if(!LIBCURL_FOUND OR "${LIBCURL_FOUND}" STREQUAL "") if(NOT LIBCURL_FOUND)
pkg_config_library(LIBCURL libcurl REQUIRED) pkg_config_library(LIBCURL libcurl REQUIRED)
endif() endif()
if("${LIBSSH2_LIBRARY_DIRS}" STREQUAL "") if(NOT LIBSSH2_LIBRARY_DIRS)
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES} ${LIBCURL_LIBRARIES} -lcrypto) set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES} ${LIBCURL_LIBRARIES} -lcrypto)
else() else()
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -L${LIBSSH2_LIBRARY_DIRS} ${LIBSSH2_LIBRARIES} ${LIBCURL_LIBRARIES} -lcrypto) set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -L${LIBSSH2_LIBRARY_DIRS} ${LIBSSH2_LIBRARIES} ${LIBCURL_LIBRARIES} -lcrypto)