[英]How to execute all gtests for a cmake project with qtcreator?
(As a follow up to this question ) (作为这个问题的后续跟进)
My cmake file looks like this: 我的cmake文件如下所示:
include(CTest)
add_subdirectory(/usr/src/gtest gtest)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(TestA TestA.cpp)
target_link_libraries(TestA gtest)
add_test(NAME AllTestsInA COMMAND TestA)
add_executable(TestB TestB.cpp)
target_link_libraries(TestB gtest)
add_test(NAME AllTestsInB COMMAND TestB)
I am able to run single tests from within qtcreator and all tests from command line using ctest --output-on-failure
, but how can I execute all tests from within qtcreator? 我能够在qtcreator中运行单个测试,并使用
ctest --output-on-failure
从命令行进行所有测试,但是如何从qtcreator中执行所有测试?
qtcreator version: 2.7.0 qtcreator版本:2.7.0
You should have a target called just test
. 你应该有一个名为
test
的目标。 If you build this, it executes all the tests. 如果你构建它,它会执行所有测试。
For non-makefile IDEs (like Visual Studio) the equivalent target is called RUN_TESTS
. 对于非makefile IDE(如Visual Studio),等效目标称为
RUN_TESTS
。
Using QtCreator 2.4.1, try adding a custom build step: Projects -> "Build Steps" -> [Add Build Step]. 使用QtCreator 2.4.1,尝试添加自定义构建步骤:项目 - >“构建步骤” - > [添加构建步骤]。 [x] Enable this step and use "ctest" as the command.
[x]启用此步骤并使用“ctest”作为命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.