cmake寻找openssl包时遇到的坑

OPENSSL_FOUND

System has the OpenSSL library. If no components are requested it only requires the crypto library.

OPENSSL_INCLUDE_DIR

The OpenSSL include directory.

OPENSSL_CRYPTO_LIBRARY

The OpenSSL crypto library.

OPENSSL_CRYPTO_LIBRARIES

The OpenSSL crypto library and its dependencies.

OPENSSL_SSL_LIBRARY

The OpenSSL SSL library.

OPENSSL_SSL_LIBRARIES

The OpenSSL SSL library and its dependencies.

OPENSSL_LIBRARIES

All OpenSSL libraries and their dependencies.

cmake编译时,提示少了上面某些变量,于是在环境变量设置,尝试了各种设置方法,无果,最后发现这一节的标题是

Result Variables

This module will set the following variables in your project:

说明这是运行时设置的,而真正要设置的环境变量应该只有这些:

The following variables may be set to control search behavior:

OPENSSL_ROOT_DIR

Set to the root directory of an OpenSSL installation.

OPENSSL_USE_STATIC_LIBS

Added in version 3.4.

Set to TRUE to look for static libraries.

OPENSSL_MSVC_STATIC_RT

Added in version 3.5.

Set to TRUE to choose the MT version of the lib.

ENV{PKG_CONFIG_PATH}

On UNIX-like systems, pkg-config is used to locate the system OpenSSL. Set the PKG_CONFIG_PATH environment variable to look in alternate locations. Useful on multi-lib systems.

最关键的就是第一个根目录,并且其子目录下必须有include和lib目录不能改名,这两个子目录下不能套子目录,目录结果不对的话,怎么设置环境变量都不好使,因为笔者原来就是第三方构建的release目录结构不对,死活不行试了几个小时,最后吐血解决了。

上面划线部分不对,有子目录也是可以的,不过似乎要指定平台,编译器等等信息,就可以找到路径了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值