From 1e2e3f8e489a36ee36faad649ab4d81f0e8e36ec Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 11 Jan 2021 07:55:53 +0100 Subject: [PATCH] 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 --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 122bb1aa92d..e053a15da7d 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -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) {