CMake:打包后步骤 [英] Cmake : post-package step

查看:122
本文介绍了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:打包后步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆