2

I am trying to build libwebsockets on Windows 10 using CMake and MinGW. The library requires OpenSSL.

Environment Variables: OPENSSL_CONF=C:\Program Files (x86)\OpenSSL-Win32\bin\openssl.cfg OPENSSL_ROOT_DIR=C:\Program Files (x86)\OpenSSL-Win32

I'm using this to build: cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:/MinGW -DOPENSSL_LIBRARIES="C:\Program Files (x86)\OpenSSL-Win32\lib" -DOPENSSL_CONF="C:\Program Files (x86)\OpenSSL-Win32\openssl.cfg" -DOPENSSL_INCLUDE_DIR="C:\Program Files (x86)\OpenSSL-Win32\include" ..\

The error I get is:

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found version "1.1.0")

I downloaded the OpenSSL binaries from a community build and have used both 64 and 32 versions.

I've even modified the CMake file to confirm the variables were being passed in.

Shroder
  • 573
  • 2
  • 5
  • 23
  • 1
    Open command prompt and `echo %OPENSSL_ROOT_DIR%`, what is the output ? – SimpleGuy Sep 12 '16 at 14:44
  • Variable `OPENSSL_ROOT_DIR` should point to the **root** folder, not to the *bin* folder. Setting variable `OPENSSL_LIBRARIES` from command line (or in CMake cache) is useless, as script [findOpenSSL.cmake](https://github.com/Kitware/CMake/blob/master/Modules/FindOpenSSL.cmake) ignores such settings. – Tsyvarev Sep 12 '16 at 15:45
  • I've updated my environment variables. echo %OPENSSL_ROOT_DIR% now outputs D:\libs\OpenSSL-Win64. I still get the error with the environment variable set. – Shroder Sep 13 '16 at 04:09
  • Have you deleted you build directory and re-run CMake? – usr1234567 Sep 13 '16 at 06:25
  • @usr1234567 Yes, I have cleared the build directory. I will edit my question with some updates. – Shroder Sep 16 '16 at 13:16
  • I updated the build command and environment variables. The paths are now have the OpenSSL dir in Program Files, as I saw that was a location that is auto-searched by FindOpenSSL.cmake. – Shroder Sep 16 '16 at 13:36
  • I think perhaps my problem is I need to point the libraries directory to "C:\Program Files (x86)\OpenSSL-Win32\lib\MinGW". I'll try this when I can later. – Shroder Sep 16 '16 at 15:02

1 Answers1

0

This was a problem with the version of CMake I was using. I upgraded from CMake 3.3.x to 3.6.2 and the build is now successful.

Shroder
  • 573
  • 2
  • 5
  • 23
  • I'm using the latest version 3.6.2 and am still getting this error. – Jnr Sep 25 '16 at 12:16
  • @Jnr Are you also building libwebsockets? If you haven't already, try the steps mentioned under the comments of the question post. Where is your OpenSSL binaries located, and does echo %OPENSSL_ROOT_DIR% output anything? – Shroder Sep 28 '16 at 15:09
  • Yes, I have read those comments. Please see my question here http://stackoverflow.com/questions/39696840/cmake-error-could-not-find-openssl?noredirect=1#comment66694544_39696840 perhaps you can answer it. – Jnr Sep 29 '16 at 06:31