Cmake Openssl not found

Kag*_*sen 5 openssl cmake cross-compiling

Want to cross-compile a C application that uses Azure IoT SDK, which unfortunately requires Cmake. Cmake refuses to build my toolchain because it claims that it cannot find Openssl that I've compiled for my target architecture.

I've tried adding OPENSSL_ROOT_DIR to the folder it's in.

SET(OPENSSL_ROOT_DIR /path/to/openssl)
Run Code Online (Sandbox Code Playgroud)

I continually get the error:

  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.0.2g")
Run Code Online (Sandbox Code Playgroud)

我还尝试按照错误提示将系统变量设置为这些文件夹,但它似乎忽略了它们并提示相同的错误。我试过将它添加到与我的 C 编译器相同的文件夹中也无济于事。

我已经没有什么可以尝试的了,这一点我不明白为什么它不起作用。有什么建议?

Udd*_*tam 7

在 Linux 中,我设置 OpenSSL 没有任何问题。

在 Windows 中,我解决了如下所述。

尝试删除CMakeCache.txt文件,然后再做一次。缓存 Cmake 是主要问题。

例如,我做到了cmake . -DOPENSSL_ROOT_DIR=C:\openssl-1.0.2 -DOPENSSL_INCLUDE_DIR=C:\openssl-1.0.2\include -DOPENSSL_CRYPTO_LIBRARY=C:\openssl-1.0.2\crypto,一切都解决了。逻辑是一样的。

在此处输入图片说明