如何指定OpenSSL系统变量?
我试图将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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论