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

    1. <tfoot id='FwYao'></tfoot>

        <legend id='FwYao'><style id='FwYao'><dir id='FwYao'><q id='FwYao'></q></dir></style></legend>

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

      1. 将外部库添加到 CMakeList.txt C++

        时间:2023-08-28
          <i id='VYIVR'><tr id='VYIVR'><dt id='VYIVR'><q id='VYIVR'><span id='VYIVR'><b id='VYIVR'><form id='VYIVR'><ins id='VYIVR'></ins><ul id='VYIVR'></ul><sub id='VYIVR'></sub></form><legend id='VYIVR'></legend><bdo id='VYIVR'><pre id='VYIVR'><center id='VYIVR'></center></pre></bdo></b><th id='VYIVR'></th></span></q></dt></tr></i><div id='VYIVR'><tfoot id='VYIVR'></tfoot><dl id='VYIVR'><fieldset id='VYIVR'></fieldset></dl></div>

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

            <tbody id='VYIVR'></tbody>
              <bdo id='VYIVR'></bdo><ul id='VYIVR'></ul>

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

                • 本文介绍了将外部库添加到 CMakeList.txt C++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有我的外部库,如下图所示,我在之后创建符号链接:

                  I have my external library as shown in this picture that I create the symbolic links after:

                  以及其他文件中与库相关的头文件:

                  and the headers related to the library in other file:

                  我正在使用 ROS ubuntu,我需要将这些库添加到我的包中到 CmakeList.txt:

                  I'm working with ROS ubuntu and I need to add these libraries to my package to CmakeList.txt:

                  cmake_minimum_required(VERSION 2.4.6)
                  include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
                  
                  rosbuild_init()
                  
                  #set the default path for built executables to the "bin" directory
                  set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
                  #set the default path for built libraries to the "lib" directory
                  set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
                  
                  #common commands for building c++ executables and libraries
                  #rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
                  #target_link_libraries(${PROJECT_NAME} another_library)
                  #rosbuild_add_boost_directories()
                  #rosbuild_link_boost(${PROJECT_NAME} thread)
                  #rosbuild_add_executable(example examples/example.cpp)
                  #target_link_libraries(example ${PROJECT_NAME})
                  
                  rosbuild_add_executable(kinectueye src/kinect_ueye.cpp)
                  

                  所以我的问题是如何将这些文件夹(我认为我需要添加的第一个文件夹我不确定)添加到我的 CmakeList.txt 文件中,以便我可以使用这些类以及我程序中的方法.

                  So my question is how can I add these folders (I think the first one that I need to add I'm not sure) to my CmakeList.txt file so as I can use the classes and the methods in my program.

                  推荐答案

                  我会从升级 CMAKE 版本开始.

                  I would start with upgrade of CMAKE version.

                  您可以使用 INCLUDE_DIRECTORIES 作为标题位置和 LINK_DIRECTORIES + TARGET_LINK_LIBRARIES 图书馆

                  You can use INCLUDE_DIRECTORIES for header location and LINK_DIRECTORIES + TARGET_LINK_LIBRARIES for libraries

                  INCLUDE_DIRECTORIES(your/header/dir)
                  LINK_DIRECTORIES(your/library/dir)
                  rosbuild_add_executable(kinectueye src/kinect_ueye.cpp)
                  TARGET_LINK_LIBRARIES(kinectueye lib1 lib2 lib2 ...)
                  

                  注意 lib1 被扩展为 liblib1.so(在 Linux 上),所以 使用 ln 创建适当的链接,以防您没有它们

                  note that lib1 is expanded to liblib1.so (on Linux), so use ln to create appropriate links in case you do not have them

                  这篇关于将外部库添加到 CMakeList.txt C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 CMake 将资源(例如,着色器代码;图像)嵌入到可执行文件/库中 下一篇:CMake:无法运行 MSBuild 命令:MSBuild.exe

                  相关文章

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

                    • <bdo id='IcCLZ'></bdo><ul id='IcCLZ'></ul>

                  1. <legend id='IcCLZ'><style id='IcCLZ'><dir id='IcCLZ'><q id='IcCLZ'></q></dir></style></legend>

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