gpt4 book ai didi

cmake - CLion 构建依赖目标

转载 作者:行者123 更新时间:2023-12-03 17:48:25 27 4
gpt4 key购买 nike

我的 CLions CMakeLists.txt 包含 1 个以上的目标(库和依赖可执行文件)。
如何配置一键构建所有目标,而不是一个一个选择目标并构建它们?
例如,在 Visual Studio 中,我可以配置项目依赖项并构建所有解决方案。 CLions“编辑配置...”->“启动前:构建”对我不起作用。

最佳答案

您可以添加命令 add_dependencies给您的 CMakeLists.txt ,它做你想要的:

Make a top-level target depend on other top-level targets to ensure that they build before does.



然后您只需要创建一个依赖于其他所有目标的“BUILD_ALL”目标。

关于cmake - CLion 构建依赖目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27869503/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com