1. <small id='sugom'></small><noframes id='sugom'>

        <bdo id='sugom'></bdo><ul id='sugom'></ul>
      <i id='sugom'><tr id='sugom'><dt id='sugom'><q id='sugom'><span id='sugom'><b id='sugom'><form id='sugom'><ins id='sugom'></ins><ul id='sugom'></ul><sub id='sugom'></sub></form><legend id='sugom'></legend><bdo id='sugom'><pre id='sugom'><center id='sugom'></center></pre></bdo></b><th id='sugom'></th></span></q></dt></tr></i><div id='sugom'><tfoot id='sugom'></tfoot><dl id='sugom'><fieldset id='sugom'></fieldset></dl></div>
      <legend id='sugom'><style id='sugom'><dir id='sugom'><q id='sugom'></q></dir></style></legend>
      <tfoot id='sugom'></tfoot>

      1. 在 CMakeList.txt 文件中包含 OpenSSL

        Include OpenSSL in a CMakeList.txt file(在 CMakeList.txt 文件中包含 OpenSSL)
        <i id='SXHf4'><tr id='SXHf4'><dt id='SXHf4'><q id='SXHf4'><span id='SXHf4'><b id='SXHf4'><form id='SXHf4'><ins id='SXHf4'></ins><ul id='SXHf4'></ul><sub id='SXHf4'></sub></form><legend id='SXHf4'></legend><bdo id='SXHf4'><pre id='SXHf4'><center id='SXHf4'></center></pre></bdo></b><th id='SXHf4'></th></span></q></dt></tr></i><div id='SXHf4'><tfoot id='SXHf4'></tfoot><dl id='SXHf4'><fieldset id='SXHf4'></fieldset></dl></div>
        • <tfoot id='SXHf4'></tfoot>

          <small id='SXHf4'></small><noframes id='SXHf4'>

                <tbody id='SXHf4'></tbody>

              • <legend id='SXHf4'><style id='SXHf4'><dir id='SXHf4'><q id='SXHf4'></q></dir></style></legend>
                • <bdo id='SXHf4'></bdo><ul id='SXHf4'></ul>
                  本文介绍了在 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:

                  #include <iostream>
                  #include <podofo/podofo.h>
                  
                  int main() {
                    PoDoFo::PdfMemDocument pdf;
                    pdf.Load("/Users/user/path/to.pdf");
                  
                    int nbOfPage = pdf.GetPageCount();
                  
                    std::cout << "Our pdf have " << nbOfPage << " pages." << std::endl;
                    return 0;
                  }
                  

                  我的 CMakeList.txt 是:

                  My CMakeList.txt is:

                  cmake_minimum_required(VERSION 3.7)
                  project(untitled)
                  
                  set(CMAKE_CXX_STANDARD 14)
                  
                  set(SOURCE_FILES main.cpp)
                  
                  add_executable(untitled ${SOURCE_FILES})
                  

                  但我被这个错误困住了:

                  But I am stuck with this error:

                  /usr/local/include/podofo/base/PdfEncrypt.h:44:10: fatal error: 'openssl/opensslconf.h' file not found
                  #include <openssl/opensslconf.h
                  

                  我尝试使用 find_packagefind_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:

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

                  如果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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                      • <bdo id='EfePi'></bdo><ul id='EfePi'></ul>

                          <tbody id='EfePi'></tbody>

                      • <small id='EfePi'></small><noframes id='EfePi'>

                            <legend id='EfePi'><style id='EfePi'><dir id='EfePi'><q id='EfePi'></q></dir></style></legend>
                            <i id='EfePi'><tr id='EfePi'><dt id='EfePi'><q id='EfePi'><span id='EfePi'><b id='EfePi'><form id='EfePi'><ins id='EfePi'></ins><ul id='EfePi'></ul><sub id='EfePi'></sub></form><legend id='EfePi'></legend><bdo id='EfePi'><pre id='EfePi'><center id='EfePi'></center></pre></bdo></b><th id='EfePi'></th></span></q></dt></tr></i><div id='EfePi'><tfoot id='EfePi'></tfoot><dl id='EfePi'><fieldset id='EfePi'></fieldset></dl></div>
                            <tfoot id='EfePi'></tfoot>