CMakeProjectManager: Fix initial ctest call

CMake settings can avoid to create the build directory
automatically. If this is the case the ctest call fails
due to missing information that is present inside the
build directory.
In this case we need to use the temporary directory that
is used before the build directory is created.

Change-Id: Ie6581e53a671c3e5ad71474d9706285d29bd37a8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-01-11 07:55:53 +01:00
parent 26993a5799
commit 1e2e3f8e48

View File

@@ -906,11 +906,15 @@ void CMakeBuildSystem::runCTest()
}
qCDebug(cmakeBuildSystemLog) << "Requesting ctest run after cmake run";
BuildDirParameters parameters(cmakeBuildConfiguration());
QTC_ASSERT(parameters.isValid(), return);
FilePath workingDirectory = workDirectory(parameters);
CommandLine cmd{m_ctestPath, {"-N", "--show-only=json-v1"}};
SynchronousProcess ctest;
ctest.setTimeoutS(1);
ctest.setEnvironment(cmakeBuildConfiguration()->environment().toStringList());
ctest.setWorkingDirectory(cmakeBuildConfiguration()->buildDirectory().toString());
ctest.setWorkingDirectory(workingDirectory.toString());
const SynchronousProcessResponse response = ctest.run(cmd);
if (response.result == SynchronousProcessResponse::Finished) {