QtCreator 4.3中的CMake显示了许多自动目标,如何删除/隐藏它们?

问题描述:

我刚刚切换到最新版本的QtCreator(4.3.1),项目浏览器现在显示了许多目标,例如 ContinuousBuild,ContinuousConfigure,NightlyBuild,experimentalCoverage 等。

I just switched to the last version of QtCreator (4.3.1) and the project explorer now shows many targets like ContinuousBuild, ContinuousConfigure, NightlyBuild, ExperimentalCoverage etc.

如何删除所有这些(或至少隐藏它们)?

我什至不知道这在CMake中生成的位置。

How can I remove all of these (or at least hide them) ?
I don't even know where this is generated in CMake.

似乎与此问题相关隐藏自动生成的CTest目标,但我没有使用CLion 。

Seems to be related to this question Hide automatically generated CTest targets except that I am not using CLion.

您可能正在某个地方使用:

You are probably using somewhere:

include(CTest)

根据文档


配置一个要使用CTest / CDash进行测试的项目

Configure a project for testing with CTest/CDash

所有这些目标都由两者的组合实现, C测试 CDash (几乎所有这些实际上都是由于后者)。

如果您不知道它们为什么在那里以及可以使用什么,则可能是您使用了错误的命令。

All those targets are pulled in by the combination of the two, CTest and CDash (almost all of them are due to the latter actually).
If you don't know why they are there and for what they can be used, probably you are using the wrong command.

如果您只想使用全部 CTest ,使用 add_test 添加测试,并使用 make test 运行它们>,将上面一行替换为:

If all what you want is to use only CTest, add tests with add_test and run them with make test, replace the line above with this one:

enable_testing()

文档确实非常清楚:


对当前目录及以下版本启用测试。

Enable testing for current directory and below.

清理构建目录并从 QtCreator 内从头运行 cmake >。您提到的所有目标都应该消失。

Clean up the build directory and run cmake from scratch from within QtCreator. All the targets you mentioned should disappear.

当我更新 QtCreator 几个月前。您可以在项目的历史记录中看到 commit 问题。确实很短。

I had exactly the same problem in a project of mine when I updated QtCreator a couple of months ago. You can see in the history of the project the commit that solved the issue. Pretty short indeed.