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

        <bdo id='xQeQU'></bdo><ul id='xQeQU'></ul>
      <tfoot id='xQeQU'></tfoot>
    1. <legend id='xQeQU'><style id='xQeQU'><dir id='xQeQU'><q id='xQeQU'></q></dir></style></legend>

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

      CMake 中的 include_directories 和 target_include_directories 有什

      What is the difference between include_directories and target_include_directories in CMake?(CMake 中的 include_directories 和 target_include_directories 有什么区别?)

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

            <tbody id='LwVGz'></tbody>

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

            • <tfoot id='LwVGz'></tfoot>
              1. 本文介绍了CMake 中的 include_directories 和 target_include_directories 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我的 C++ 代码有一个目录结构,如下所示:

                <代码>||->包括|->src

                我正在为我的代码编写一个 CMakeLists.txt 文件.我想了解 CMakeinclude_directoriestarget_include_directories 之间的区别.

                它们的用法和为了添加我的包含文件路径我应该使用哪一个有什么区别?

                解决方案

                include_directories(x/y) 影响目录范围.此 CMakeList 中的所有目标,以及在其调用点之后添加的所有子目录中的目标,都将路径 x/y 添加到它们的包含路径中.

                target_include_directories(tx/y) 具有目标范围——它将x/y 添加到目标 t 的包含路径中.

                如果您的所有目标都使用相关的包含目录,则您需要前者.如果路径特定于目标,或者您想要更好地控制路径的可见性,则您需要后者.后者来自于 target_include_directories() 支持 PRIVATEPUBLICINTERFACE 限定符的事实.>

                I have a directory structure for my C++ code which goes like this :

                |
                |->include
                |->src
                

                I am writing a CMakeLists.txt file for my code. I want to understand the difference between include_directories and target_include_directories in CMake.

                What is the difference between their usage and in order to add my include file path which one should I be using?

                解决方案

                include_directories(x/y) affects directory scope. All targets in this CMakeList, as well as those in all subdirectories added after the point of its call, will have the path x/y added to their include path.

                target_include_directories(t x/y) has target scope—it adds x/y to the include path for target t.

                You want the former one if all of your targets use the include directories in question. You want the latter one if the path is specific to a target, or if you want finer control of the path's visibility. The latter comes from the fact that target_include_directories() supports the PRIVATE, PUBLIC, and INTERFACE qualifiers.

                这篇关于CMake 中的 include_directories 和 target_include_directories 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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?)
                <i id='gbtR4'><tr id='gbtR4'><dt id='gbtR4'><q id='gbtR4'><span id='gbtR4'><b id='gbtR4'><form id='gbtR4'><ins id='gbtR4'></ins><ul id='gbtR4'></ul><sub id='gbtR4'></sub></form><legend id='gbtR4'></legend><bdo id='gbtR4'><pre id='gbtR4'><center id='gbtR4'></center></pre></bdo></b><th id='gbtR4'></th></span></q></dt></tr></i><div id='gbtR4'><tfoot id='gbtR4'></tfoot><dl id='gbtR4'><fieldset id='gbtR4'></fieldset></dl></div>

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

              2. <tfoot id='gbtR4'></tfoot>
                  <tbody id='gbtR4'></tbody>

              3. <legend id='gbtR4'><style id='gbtR4'><dir id='gbtR4'><q id='gbtR4'></q></dir></style></legend>
                      <bdo id='gbtR4'></bdo><ul id='gbtR4'></ul>