CMake 自定义清理命令

发布于 2024-09-27 18:51:16 字数 403 浏览 1 评论 0原文

在我的 CMake 项目中,我希望在运行 clean 目标时发生一些自定义行为。但是,如果我这样做

add_dependencies(clean extra-clean)

,它会失败,

add_dependencies Adding dependency to non-existent target: clean

并显示 Is it Even possible to have custom clean behavior?

编辑:我正在运行一些外部工具作为构建的一部分。这些工具会生成大量文件,但只需要求工具执行此操作即可清理它们。理想情况下,我可以将自定义目标添加到清理目标中,以调用该工具进行清理。

In my CMake project I'd like to have some custom behavior happen when the clean target is run. However, if I do

add_dependencies(clean extra-clean)

it fails with

add_dependencies Adding dependency to non-existent target: clean

Is it even possible to have custom clean behavior?

EDIT: I am running some external tools as part of the build. These tools generate lots of files, but they can be cleaned up simply by asking the tool to do so. Ideally, I could add a custom target to the clean target to call the tool to do its cleanup.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

翻了热茶 2024-10-04 18:51:16

您正在寻找什么自定义行为?如果您需要删除文件,可以使用
set_directory_properties

What is the custom behavior you are looking for? If you need to remove files you can use
set_directory_properties.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文