Reputation: 7
I am trying to integrate CMake, Visual Studio and QTest. I have tried the many suggestions, this is my latest, which upon building produces the error:
Severity Code Description Project File Line
Suppression State
Error MSB3073 The command "setlocal
"C:\Program Files\CMake\bin\ctest.exe" --force-new-ctest-process -C Debug
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 8. RUN_TESTS C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 155
This is my cmakeLists.txt
project(mytest LANGUAGES CXX)
find_package(Qt5Test REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
enable_testing(true)
add_executable(mytest tst_mytest.cpp)
add_test(NAME mytest COMMAND mytest)
target_link_libraries(mytest PRIVATE Qt5::Test)
This is the code
#include <QtTest>
class MyTest : public QObject {
Q_OBJECT
private slots:
void testMyFunction();
};
void MyTest::testMyFunction() {
// Your test code here
QVERIFY(true);
}
QTEST_MAIN(MyTest)
#include "mytest.moc"
I cannot see what I am doing incorrectly
Upvotes: 0
Views: 16