<tfoot id='YE5nC'></tfoot>
      <bdo id='YE5nC'></bdo><ul id='YE5nC'></ul>

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

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

      <legend id='YE5nC'><style id='YE5nC'><dir id='YE5nC'><q id='YE5nC'></q></dir></style></legend>
    1. 可以将导入的库添加到 target_link_libraries 来处理包含目录吗?

      Possible to add an imported library to target_link_libraries that takes care of include directories too?(可以将导入的库添加到 target_link_libraries 来处理包含目录吗?)
        <bdo id='NANTb'></bdo><ul id='NANTb'></ul>

              <tbody id='NANTb'></tbody>
            <legend id='NANTb'><style id='NANTb'><dir id='NANTb'><q id='NANTb'></q></dir></style></legend>

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

            2. <small id='NANTb'></small><noframes id='NANTb'>

                本文介绍了可以将导入的库添加到 target_link_libraries 来处理包含目录吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                不知何故,我正在努力找出是否可以在 CMake 中定义导入的库,指定目标属性(include_directories 和库路径),并希望一旦我将该项目添加到另一个项目中的 target_link_libraries,CMake 将附加包含目录.

                somehow I am struggling with finding out whether it is possible to define an imported library in CMake, specifying target properties (include_directories and library path) and hoping that CMake will append the include directories once I add that project to target_link_libraries in another project.

                假设我在名为 Module-Conf.cmake 的文件中有一个导入的库:

                Let's say I have an imported library in a file called Module-Conf.cmake:

                add_library(mymodule STATIC IMPORTED)
                set_target_properties(mymodule PROPERTIES IMPORTED_LOCATION "${OUTPUT_DIR}/lib")
                set_target_properties(mymodule PROPERTIES INCLUDE_DIRECTORIES "${OUTPUT_DIR}/include")
                

                在一个项目中,我添加了依赖项:

                And in a project I add the dependency:

                include(Module-Conf)
                target_link_libraries(${PROJECT_NAME} mymodule)
                

                CMake 会将 include_directories 属性附加到包含路径吗?现在我看不到路径,所以似乎我必须使用 get_target_property 自己完成?

                Will CMake append the include_directories property to the include path? Right now I cannot see the path so it seems that I have to do it by myself by using get_target_property?

                问题:我可以做一些 CMake 魔术来自动将包含附加到另一个项目的包含目录吗?

                Question: Can I do some CMake magic to automatically append the include to the include directories of another project?

                非常感谢.马丁

                推荐答案

                INCLUDE_DIRECTORIES 属性和 INTERFACE_INCLUDE_DIRECTORIES 属性之间的区别在于传递性.

                The difference between the INCLUDE_DIRECTORIES property and the INTERFACE_INCLUDE_DIRECTORIES property is transitivity.

                改为设置 INTERFACE_INCLUDE_DIRECTORIES.

                http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#transitive-usage-requirements

                这篇关于可以将导入的库添加到 target_link_libraries 来处理包含目录吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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='wWidw'></bdo><ul id='wWidw'></ul>

                • <legend id='wWidw'><style id='wWidw'><dir id='wWidw'><q id='wWidw'></q></dir></style></legend>
                  • <small id='wWidw'></small><noframes id='wWidw'>

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