• <legend id='bZcPr'><style id='bZcPr'><dir id='bZcPr'><q id='bZcPr'></q></dir></style></legend>
  • <tfoot id='bZcPr'></tfoot>

      <bdo id='bZcPr'></bdo><ul id='bZcPr'></ul>

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

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

      1. 如何在 linux 上通过 cmake 链接 google protobuf 库?

        How to link google protobuf libraries via cmake on linux?(如何在 linux 上通过 cmake 链接 google protobuf 库?)
          <tbody id='6RJHZ'></tbody>
        <i id='6RJHZ'><tr id='6RJHZ'><dt id='6RJHZ'><q id='6RJHZ'><span id='6RJHZ'><b id='6RJHZ'><form id='6RJHZ'><ins id='6RJHZ'></ins><ul id='6RJHZ'></ul><sub id='6RJHZ'></sub></form><legend id='6RJHZ'></legend><bdo id='6RJHZ'><pre id='6RJHZ'><center id='6RJHZ'></center></pre></bdo></b><th id='6RJHZ'></th></span></q></dt></tr></i><div id='6RJHZ'><tfoot id='6RJHZ'></tfoot><dl id='6RJHZ'><fieldset id='6RJHZ'></fieldset></dl></div>
        <legend id='6RJHZ'><style id='6RJHZ'><dir id='6RJHZ'><q id='6RJHZ'></q></dir></style></legend>
            <bdo id='6RJHZ'></bdo><ul id='6RJHZ'></ul>
          • <small id='6RJHZ'></small><noframes id='6RJHZ'>

                1. <tfoot id='6RJHZ'></tfoot>
                2. 本文介绍了如何在 linux 上通过 cmake 链接 google protobuf 库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在努力使其与我为提升所做的相同:

                  I'm trying to make it same way I made it for boost :

                  find_package(Boost COMPONENTS system filesystem REQUIRED)                                                    
                  find_package(ProtocolBuffers)                                                                                
                  
                  ## Compiler flags                                                                                            
                  if(CMAKE_COMPILER_IS_GNUCXX)                                                                                 
                      set(CMAKE_CXX_FLAGS "-O2")                                                                               
                      set(CMAKE_EXE_LINKER_FLAGS "-lsqlite3 -lrt -lpthread")                                                   
                  endif()                                                                                                      
                  
                  target_link_libraries(complex                                                                                
                    ${Boost_FILESYSTEM_LIBRARY}                                                                                
                    ${Boost_SYSTEM_LIBRARY}                                                                                    
                    ${PROTOBUF_LIBRARY}                                                                                        
                  )  
                  

                  (在某处用谷歌搜索)但输出不好:

                  (googled it somewhere) but got bad output:

                  CMake Warning at complex/CMakeLists.txt:18 (find_package):
                    Could not find module FindProtocolBuffers.cmake or a configuration file for
                    package ProtocolBuffers.
                  
                    Adjust CMAKE_MODULE_PATH to find FindProtocolBuffers.cmake or set
                    ProtocolBuffers_DIR to the directory containing a CMake configuration file
                    for ProtocolBuffers.  The file will have one of the following names:
                  
                      ProtocolBuffersConfig.cmake
                      protocolbuffers-config.cmake
                  

                  如何将其与 cmake 链接?或者我什至可以使用 cmake 编译 .proto 文件?

                  How can I link it with cmake? or maybe I even can compile .proto file using cmake?

                  推荐答案

                  你可以试试 CMake 的 FindProtobuf 模块:

                  You could try CMake's FindProtobuf module:

                  include(FindProtobuf)
                  find_package(Protobuf REQUIRED)
                  include_directories(${PROTOBUF_INCLUDE_DIR})
                  ...
                  target_link_libraries(complex
                      ${Boost_FILESYSTEM_LIBRARY}
                      ${Boost_SYSTEM_LIBRARY}
                      ${PROTOBUF_LIBRARY}
                  )
                  


                  有关更多信息,请运行


                  For further info, run

                  cmake --help-module FindProtobuf
                  

                  这篇关于如何在 linux 上通过 cmake 链接 google protobuf 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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?)
                  <tfoot id='ysasT'></tfoot>

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

                            <tbody id='ysasT'></tbody>