【问题标题】:CMake "Could NOT find OpenSSL" with MSYS2/mingw64 on WindowsCMake 在 Windows 上使用 MSYS2/mingw64 “找不到 OpenSSL”
【发布时间】:2019-08-04 11:00:59
【问题描述】:

我正在尝试在 Windows 上使用 MSYS2 和 mingw64 编译 this project,当运行 cmake . 时,我得到以下输出:

-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.16299.
-- Build type: Release
-- Source of Randomness: random_device
CMake Error at C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  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 "1.1.1b")
Call Stack (most recent call first):
  C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  C:/msys64/mingw64/share/cmake-3.13/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
  CMakeLists.txt:10 (find_package)

我已安装 OpenSSL,如下所示:

$ which openssl
/mingw64/bin/openssl

$ openssl version
OpenSSL 1.1.1b  26 Feb 2019

它似乎正在寻找的 OPENSSL_CRYPTO_LIBRARY 是 /mingw64/lib/libcrypto.a 或 /mingw64/lib/libcrypto.dll.a。

真正让我陷入循环的是,在 CMake 错误消息中,它说“找到版本 1.1.1b”,很明显它能够找到它。有人对如何解决此错误有建议吗?

【问题讨论】:

    标签: windows cmake openssl mingw msys


    【解决方案1】:

    原来,我需要将-G "Unix Makefiles" 添加到我的cmake 命令中。默认情况下,它正在生成 Visual Studio 解决方案/项目,这不是您在 mingw 中想要的,并且通过添加此标志,它能够找到 openssl 文件。

    【讨论】:

      猜你喜欢
      • 2017-05-31
      • 2017-09-25
      • 1970-01-01
      • 2021-09-09
      • 2020-10-17
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      相关资源
      最近更新 更多