8000 Fix finding and linking libssh2 by jeroen · Pull Request #6602 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Fix finding and linking libssh2 #6602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/FindPkgLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ function(FIND_PKGLIBRARIES prefix package)
foreach(LIBRARY ${${prefix}_LIBRARIES})
find_library(${LIBRARY}_RESOLVED ${LIBRARY} PATHS ${${prefix}_LIBRARY_DIRS})
if(${${LIBRARY}_RESOLVED} STREQUAL "${LIBRARY}_RESOLVED-NOTFOUND")
message(FATAL_ERROR "could not resolve ${LIBRARY}")
message(WARNING "could not resolve ${LIBRARY}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my only question - why are we changing this from a fatal to a warning? What's the operational change that this makes? If - for example - I asked for libssh2 on the command line and we couldn't find it, that should be a hard fail, shouldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to explain this in the post above: on Windows we need to link some Windows SDK dlls such as ws2_32.lib. Cmake does not find these on the command line, so it fails, but the mingw-w64 linker can find them just fine.

See: https://cmake.org/pipermail/cmake/2010-July/037875.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps another solution would be to skip-list known windows sdk libraries.

endif()
list(APPEND RESOLVED_LIBRARIES ${${LIBRARY}_RESOLVED})
endforeach()

set(${prefix}_FOUND 1 PARENT_SCOPE)
set(${prefix}_LIBRARIES ${RESOLVED_LIBRARIES} PARENT_SCOPE)
set(${prefix}_LIBRARIES ${${prefix}_LIBRARIES} PARENT_SCOPE)
set(${prefix}_INCLUDE_DIRS ${${prefix}_INCLUDE_DIRS} PARENT_SCOPE)
set(${prefix}_LDFLAGS ${${prefix}_LDFLAGS} PARENT_SCOPE)

Expand Down
2 changes: 1 addition & 1 deletion cmake/SelectSSH.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Optional external dependency: libssh2
if(USE_SSH)
find_pkglibraries(LIBSSH2 ssh2)
find_pkglibraries(LIBSSH2 libssh2)
if(NOT LIBSSH2_FOUND)
find_package(LibSSH2)
set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
Expand Down
0