CMake:打包后步骤

编程入门 行业动态 更新时间:2024-10-26 05:32:59
本文介绍了CMake:打包后步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一种包装完成后执行代码的方法.

I'm looking for a way to execute a code after the packaging is done.

我试图添加一个取决于生成的PACKAGE目标的自定义目标.看起来不起作用,这是cmake错误:

I tried to add a custom target that was depending on the PACKAGE target generated. That looks like it does not work, here's cmake error:

CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle): "ALL_BUILD" of type UTILITY depends on "UPLOAD" (strong) "PACKAGE" of type GLOBAL_TARGET depends on "ALL_BUILD" (strong) "UPLOAD" of type UTILITY depends on "PACKAGE" (strong) At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.

为此,我习惯于以下代码:

To do this I used to following code:

add_custom_target(UPLOAD ALL COMMAND cmake -E echo "Should be post packging!" ) add_dependencies(UPLOAD PACKAGE)

是否有某种方法可以让目标文件上传已打包的文件?

Is there some way to have the target to UPLOAD the PACKAGEd file?

推荐答案

创建您自己的打包目标.

Create your own package target.

add_custom_target(mypackage COMMAND ${CMAKE_CPACK_COMMAND} COMMAND ${CMAKE_COMMAND} -E echo "after packaging" )

更多推荐

CMake:打包后步骤

本文发布于:2023-11-23 09:06:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620872.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   CMake

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!