<tfoot id='Cv0DT'></tfoot>
      <legend id='Cv0DT'><style id='Cv0DT'><dir id='Cv0DT'><q id='Cv0DT'></q></dir></style></legend>

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

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

        如何从 add_custom_target/command 调用 CMake 函数?

        How to call a CMake function from add_custom_target/command?(如何从 add_custom_target/command 调用 CMake 函数?)

      1. <tfoot id='vVyIl'></tfoot>
          <tbody id='vVyIl'></tbody>

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

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

                  本文介绍了如何从 add_custom_target/command 调用 CMake 函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以从 add_custom_targetadd_custom_command 中调用 CMake 函数?

                  Is it possible to call a CMake function out of an add_custom_target or add_custom_command?

                  我知道我可以将 CMake 函数移动到 Python(或其他)脚本并从 add_custom_target/command 调用它,但我想避免大量脚本在现有的 CMake 基础设施旁边.

                  I know I could move the CMake function to a Python (or whatever) script and call it from add_custom_target/command but I would like to avoid having tons of script next to the existing CMake infra.

                  我想要实现的是使用 CPack 生成二进制工件的 zip 包并将它们发布到工件存储库中.对于发布部分,我已经创建了 CMake 函数,但现在我需要将打包和发布结合在一起.

                  What I want to achieve is to use CPack for generating a zip package of binary artifacts and publish them in an artifact repository. For the publishing part I have already the CMake function created but now I need to combine the packaging and publishing together.

                  提前感谢您的任何帮助/提示.

                  Thanks for any help/hints in advance.

                  推荐答案

                  我在为 BVLC/Caffe.我最终做的是将函数内容放入一个单独的 CMake 脚本中,并通过调用从 add_custom_target 中调用它:

                  I encountered this issue while writing a CMake build system for BVLC/Caffe. What I finally did is I put the function content into a separate CMake script and called it from within add_custom_target by invoking:

                  add_custom_target(target_name
                      COMMAND ${CMAKE_COMMAND} -P path_to_script
                  )
                  

                  使用 -P 标志调用 CMake 使其充当脚本语言.您可以在脚本中放置任何 CMake 函数.

                  Invoking CMake with -P flag makes it act as a scripting language. You can put any CMake functions inside the script.

                  这篇关于如何从 add_custom_target/command 调用 CMake 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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?)
                1. <small id='9P2eO'></small><noframes id='9P2eO'>

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

                            <bdo id='9P2eO'></bdo><ul id='9P2eO'></ul>
                            <tfoot id='9P2eO'></tfoot>
                              <tbody id='9P2eO'></tbody>
                            <legend id='9P2eO'><style id='9P2eO'><dir id='9P2eO'><q id='9P2eO'></q></dir></style></legend>