c++openssllibgit2libssh2visual-c++-2015

libgit2 with libssh2 and libopenssl on windows


I’ve tried before and had little success in the full build but even that fails now and I'm obviously missing something on windows (and yes its probably windows :P)

can someone walk me through

  1. finding the correct OpenSSL to compile with libssh2
  2. actually cmake/compiling libssh2 into libgit2 cause it keeps saying cannot find libssh2 and I'm struggling to build it again.

I'm using CMake gui For windows, trying to build a VC2015 project

The error I was getting when building libgit2 is

checking for module 'libssh2'
  package 'libssh2' not found

LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.

even though I have put it in every possible place I can think it would look, and I have tried setting CMAKE_PREFIX_PATH ?

if anyone has successfully done it on windows I would appreciate a pointer or two as to what I'm doing wrong or should be doing

Thanks kindly Robert


Solution

  • libgit2 uses the cmake pkg-config module to find libssh2. The error message is probably wrong and misleading if you don't have pkg-config installed.

    I've found that the easiest way to build libgit2 with libssh2 on windows is to turn off the USE_SSH option to prevent the pkg-config search, then manually set the necessary variables. The important ones are:

    LIBSSH2_FOUND (set it to TRUE)
    LIBSSH2_INCLUDE_DIRS
    LIBSSH2_LIBRARY_DIRS
    LIBSSH2_LIBRARIES
    

    A similar thing can also be done for openssl.