本文介绍了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:打包后步骤
发布评论