<tfoot id='XXYbc'></tfoot>

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

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

        CMake 安装(子目录中的 TARGETS)

        CMake install (TARGETS in subdirectories)(CMake 安装(子目录中的 TARGETS))

          <tfoot id='NLxdR'></tfoot>

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

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

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

                  本文介绍了CMake 安装(子目录中的 TARGETS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  考虑以下 CMakeLists.txt 文件:

                  add_subdirectory(execA)
                  add_subdirectory(libB)
                  
                  install(TARGETS execA libB
                          RUNTIME DESTINATION bin
                          LIBRARY DESTINATION lib
                          ARCHIVE DESTINATION lib)
                  

                  我收到以下错误:

                  install TARGETS given target "execA" which does not exist in this
                    directory
                  

                  execAlibB 有自己的 CMakeList.txt 文件,也位于 project 目录下作为我运行的构建目录 cmake (cmake ..):

                  execA and libB have their own CMakeList.txt files and are located under project directory, as well as the build directory I'm running cmake (cmake ..):

                  project
                    |------ CMakeList.txt (the one with the code)
                    |----execA
                    |      - .cpp, .hpp and CMakelist.txt
                    |----libB
                    |      - .cpp, .hpp and CMakelist.txt
                    |---- lib
                    |---- bin
                    ---- build (where Im commanding: $ cmake ..
                  

                  我该如何解决这个错误?

                  How do I fix this error?

                  推荐答案

                  根据 this bugreport、install(TARGETS) 命令流只接受在同一目录中创建的目标.

                  According to this bugreport, install(TARGETS) command flow accepts only targets created within the same directory.

                  因此您需要将 add_library() 调用移动到顶级目录,或者将 install(TARGETS) 调用拆分为每个目标的调用,然后将每个调用将它们放到相应的子目录中.

                  So you need either move the add_library() call into the top-level directory, or split install(TARGETS) call into per-target ones, and move each of them into the corresponding subdirectory.

                  自 CMake 3.13 install(TARGETS) 即使使用在其他目录中创建的目标也可以工作.

                  Since CMake 3.13 install(TARGETS) can work even with targets created in other directories.

                  install(TARGETS) 可以安装在其他目录中创建的目标.当使用这样的跨目录安装规则时,从子目录运行 make install(或类似的)不能保证来自其他目录的目标是最新的.

                  install(TARGETS) can install targets that were created in other directories. When using such cross-directory install rules, running make install (or similar) from a subdirectory will not guarantee that targets from other directories are up-to-date.

                  这篇关于CMake 安装(子目录中的 TARGETS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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?)

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

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

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

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