在 CMakeList.txt 文件中包含 OpenSSL
问题描述
我有一个问题要问在 C++ 中使用 CMakeList.txt 的人.我想使用 Podofo
项目(一个解析和创建 pdf 的项目).
I have a question for people who work with CMakeList.txt in C++. I want to use Podofo
project (a project to parse & create pdf).
所以我的主要功能很简单:
So my main function is simple as:
我的 CMakeList.txt 是:
My CMakeList.txt is:
但我被这个错误困住了:
But I am stuck with this error:
我尝试使用 find_package
、find_library
来包含 .. 设置了一些变量,但我没有找到方法.
I tried to include with find_package
, find_library
.. setting some variables but I do not find the way.
我的环境是:
- macOS
- 克里昂
- Podofo 通过 home-brew 安装在
/usr/local/podofo
- OpenSSL 通过 home-brew 安装在
/usr/local/opt/openssl
感谢提前社区!!
推荐答案
find_package
是正确的做法;您可以在此处找到有关它的详细信息.
find_package
is the correct approach; you find details about it here.
在您的情况下,您应该添加以下几行:
In your case, you should add these lines:
如果CMake没有直接找到OpenSSL
,你应该设置CMake变量OPENSSL_ROOT_DIR
.
If CMake doesn't find OpenSSL
directly, you should set the CMake variable OPENSSL_ROOT_DIR
.
这篇关于在 CMakeList.txt 文件中包含 OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!