如何指定OpenSSL系统变量?

发布于 2025-01-29 19:21:49 字数 924 浏览 0 评论 0原文

我试图将OpenSL包括在一个简单的C ++项目中,该项目使用CMake编辑以在Windows上创建Makefile。每次我尝试编译它时,它都会给我这个错误:

找不到openssl,尝试在系统变量openssl_root_dir(缺少:openssl_crypto_library)中为OpenSSL root文件夹设置路径

找不到openssl,尝试在系统变量openssl_root_dir(缺失:openssl_crypto_library openssl_include_dir)

中设置通往OpenSSL root文件夹的路径

。 “ nofollow noreferrer”> https://github.com/openssl/openssl ,并为用户和系统设置了环境变量。我还在命令行上传递了以下参数:

-DOPENSSL_CRYPTO_LIBRARY="C:/Users/____/openssl/crypto" -DOPENSSL_ROOT_DIR="C:/Users/____/openssl" -DOPENSSL_INCLUDE_DIR="C:/Users/____/openssl/include"

这是我的cmakelists.txt看起来像:

cmake_minimum_required(VERSION 3.8.0)
project(PasswordGen)

set(CMAKE_CXX_STANDARD 14)

add_executable(PasswordGen main.cpp)

find_package(OpenSSL REQUIRED)
target_link_libraries(OpenSSL::SSL)

我该怎么办才能正确链接OpenSSL中?

I am trying to include OpenSSL in a simple C++ project, compiled using CMake to create the Makefile on Windows. Every time I try to compile it, it gives me this error:

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY)

or

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)

I have the folder cloned from https://github.com/openssl/openssl, and have set environment variables for both user and system. I have also passed the following arguments on the command line:

-DOPENSSL_CRYPTO_LIBRARY="C:/Users/____/openssl/crypto" -DOPENSSL_ROOT_DIR="C:/Users/____/openssl" -DOPENSSL_INCLUDE_DIR="C:/Users/____/openssl/include"

Here's what my CMakeLists.txt looks like:

cmake_minimum_required(VERSION 3.8.0)
project(PasswordGen)

set(CMAKE_CXX_STANDARD 14)

add_executable(PasswordGen main.cpp)

find_package(OpenSSL REQUIRED)
target_link_libraries(OpenSSL::SSL)

What should I do to properly link in OpenSSL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文