CLion构建依赖目标 [英] CLion build depend targets

查看:936
本文介绍了CLion构建依赖目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的CLions CMakeLists.txt包含多个目标(库和依赖可执行文件)。
如何配置一次点击构建所有目标,而不是逐个选择目标并构建它们?
例如,在Visual Studio中,我可以配置项目依赖项并构建所有解决方案。

My CLions CMakeLists.txt contains more than 1 target (libraries and depends executables). How can I configure building all targets in one click, instead of choosing target one by one and building them? For example, in Visual Studio I can configure project dependencies and build all solution. CLions "Edit configurations..."->"Before launch:Build" won't work for me.

推荐答案

您可以请将 add_dependencies 命令添加到您的 CMakeLists.txt ,它会做你想要的:

You can add the command add_dependencies to your CMakeLists.txt, it does what you want:


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

然后你只需要创建一个BUILD_ALL 取决于每个其他目标的目标。

Then you just need to create a "BUILD_ALL" target that depends on every other target.

这篇关于CLion构建依赖目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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