<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 函数?

        时间:2023-08-26

      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 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:CMake 和 MsVS-NuGet 下一篇:CXX 编译器标识未知

                  相关文章

                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>
                    1. <legend id='9P2eO'><style id='9P2eO'><dir id='9P2eO'><q id='9P2eO'></q></dir></style></legend>