www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: Removing non-CMake windows support (was Re: problems building under Windows)

Re: Removing non-CMake windows support (was Re: problems building under Windows)

From: Jan Ehrhardt <phpdev_at_ehrhardt.nl>
Date: Sat, 02 Jan 2016 18:10:15 +0100

Alexander Lamaison in gmane.network.ssh.libssh2.devel (Sat, 2 Jan 2016
11:12:02 +0000):
>On 2 January 2016 at 00:35, Jan Ehrhardt <phpdev_at_ehrhardt.nl> wrote:
>> CMake (on Windows) is notoriously stubborn when it comes to finding
>> libraries. I had to upgrade to CMake 3.4.1 (was 3.2.2) to be able to
>> manually specify the location of the OpenSSL library:
>> -D"OPENSSL_ROOT_DIR=/php-sdk/win64build.vc14" for 64-bits VC14 libs
>> -D"OPENSSL_ROOT_DIR=/php-sdk/win64build.vc11" for 64-bits VC11 libs
>With CMake 3.2, what was happening? Was it failing to find any
>OpenSSL, or was it finding the wrong one?

I later discovered that it wasn't the upgrade to CMake 3.4.1 that made the
real difference, but the fact that I uninstalled OpenSSL on my system. I
had it installed with the installers of
https://slproweb.com/products/Win32OpenSSL.html and then CMake prefers the
system wide OpenSSL, no matter what you specify manually. It just
disregarded OPENSSL_ROOT_DIR. See the snippet from FindOpenSSL.cmake
below. In my case it found C:\OpenSSL\Win32\1_0_2d because the registry
key pointed to that location. The difference between 3.2.2 and 3.4.1 was
that 3.2.2 always used the 32-bits key and 3.4.1 was smart enough to use
the 64-bits key when building for Win64.

>> Moreover CMake falsely #undef's HAVE_SNPRINTF in VC14. VC14 aka VS2015
>> does have a snprintf, so you will have to manually add #define
>> HAVE_SNPRINTF to libssh2_config.h
>Are you using the latest from git? This should have been fixed in

I used the 1.6.0 release tarball. Did not check git head yet.


Snippet from FindOpenSSL.cmake:

if (WIN32)
  # http://www.slproweb.com/products/Win32OpenSSL.html

      (32-bit)_is1;Inno Setup: App Path]"

      (64-bit)_is1;Inno Setup: App Path]"
  file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
else ()
endif ()

libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-01-02

the libssh2 team