CMake 自定义清理命令
在我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找什么自定义行为?如果您需要删除文件,可以使用
set_directory_properties。
What is the custom behavior you are looking for? If you need to remove files you can use
set_directory_properties.