I am trying to make my code compile on Windows, and read since a couple of days all opened discussions on stackoverflow on the subject, without finding a solution.
I installed openssl
with choco
in a terminal with privileges:
choco install openssl -y
and I notice that it gets installed to C:\Program Files\OpenSSL-Win64
.
Here is the content of the openssl
directory:
dir "$OPENSSL_ROOT_DIR"
acknowledgements.txt authors.txt bin c_rehash.pl changes.txt exp faq.txt include lib libcrypto-3-x64.dll libssl-3-x64.dll license.txt news.txt readme.txt start.bat tests unins000.dat unins000.exe
In my CMakeLists.txt
I have this relevant line:
find_package(OpenSSL REQUIRED)
Nothing very special here. And of course, it cannot be that easy:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
version "3.2.1")
So, I deleted the CMake cache, add the OPENSSL_ROOT_DIR
in my PATH
, restarted the shell, make sure that my variable OPENSSL_ROOT_DIR
is correctly set, re-launch cmake
, and same error.
I use cmake 3.28.3
and openssl
version installed is 3.2.1
.
In GitHub actions the openssl
library is installed by default for runner windows-latest
, and cmake can find it directly.
However, I have the exact similar issue for curl
, if I install it manually and provide the correct variables to cmake
, it cannot find curl
.
It works out of the box on my Ubuntu
system, just installing libcurl4-gnutls-dev libssl-dev
, I don't need to care about setting any variable whatsoever. And it worked also on GitHub actions before the latest windows-latest
runner last week.
cmake -DOPENSSL_ROOT_DIR=/path/to/openssl ...
? – Leftoverecho $OPENSSL_ROOT_DIR
that my variable is correctly set. – Irreparableopenssl
root directory. It containslibcrypto-3-x64.dll
– Irreparablecmake
with additional option--debug-find
. That way CMake will print paths which are checked for find specific libraries. From such output you could find out which paths are checked for find the library corresponding toOPENSSL_CRYPTO_LIBRARY
. – Goitercmake
3.29.0. I got the same error and upgrading appears to resolve. The issue may be addressed by gitlab.kitware.com/cmake/cmake/-/issues/25702. – Levantine