cmake - 无法找到 CTest 配置

标签 cmake ctest

我正在尝试对使用 CMake+CTest 的项目进行覆盖率分析。我创建了一个简单的TestingScript.cmake,如下所示:

set(CTEST_SOURCE_DIRECTORY .)
set(CTEST_BINARY_DIRECTORY build_coverage)

ctest_start(TestCoverage)

ctest_coverage(BUILD ${CTEST_BINARY_DIR})

我正在尝试运行它:

doriad@david-desktop:~/build/Examples/Coverage$ ctest -S ~/src/Examples/Coverage/TestingScript.cmake 
Cannot locate CTest configuration: in BuildDirectory: /home/doriad/build/Examples/Coverage/build_coverage/CTestConfig.cmake
Cannot locate CTest configuration: in SourceDirectory: /home/doriad/build/Examples/Coverage/CTestConfig.cmake
 Cannot find any coverage files. Ignoring Coverage request.

我需要做什么来生成它正在寻找的这个 CTestConfig.cmake 文件?

最佳答案

文件CTestConfig.cmake通常由CDash生成。登录 CDash 后,选择设置 > 项目 > 其他 > 下载 CTestConfig。该文件保存将结果提交到仪表板服务器的配置。

The default settings of the module are to submit the dashboard to Kitware's Public Dashboard, where you can register your project for free.

In order to submit to some other server, CTestConfig.cmake in the top level directory of your source, and set your own dashboard preferences. If you are using a CDash server, you can download a preconfigured file from the respective project page on that server (Settings / Project, tab Miscellaneous).

Source: https://gitlab.kitware.com/cmake/community/wikis/doc/ctest/Testing-With-CTest

另一个问题是您没有要提交的覆盖率文件,因为您跳过了测试脚本中的构建测试步骤。

关于cmake - 无法找到 CTest 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35143909/

相关文章:

build - CMake:如何最好地构建多个(可选)子项目?

c - CMake编译的源代码中省略头文件的声明

c++ - 如何编译并运行一个hello world JUCE程序?

testing - 如何使用 CTest 检查两个文件之间的差异?

bash - 使用 bash 与 CMake 和 CTest 进行简单的集成测试?

c++ - 来自不同文件夹的 CMake 测试源

opencv - CMake,.dll 与 .dll.a 与 .a : What library should I specify in the CMake configuration?

cmake - 如何在 CMake 中生成 GUID?

c++ - 如何使用 CMake 测试 C++ 应用程序没有内存错误?

unit-testing - 使用 ctest/cmake 测试非零退出状态