CMake: Fix missing path to ninja for ExternalProject_Add

ExternalProject_Add runs CMake not during the CMake run of the toplevel
project, but instead it runs CMake for the external project during the
build step. And while ExternalProject passes the CMAKE_COMMAND on to the
external project, it does not do so for the CMAKE_MAKE_PROGRAM.

Make sure that the make program is also found when configuring the
external project during the build step, by adding the path to ninja to
the build environment, instead of just the CMake process.

Fixes: QTCREATORBUG-27495
Change-Id: I672ec04881387a7411836ab94655176b7a5fb681
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2022-06-15 14:40:23 +02:00
parent addcfa6dc7
commit 65e043961e
3 changed files with 11 additions and 6 deletions

View File

@@ -89,12 +89,6 @@ BuildDirParameters::BuildDirParameters(CMakeBuildSystem *buildSystem)
if (Utils::HostOsInfo::isAnyUnixHost())
environment.set("ICECC", "no");
CMakeSpecificSettings *settings = CMakeProjectPlugin::projectTypeSpecificSettings();
if (!settings->ninjaPath.filePath().isEmpty()) {
const Utils::FilePath ninja = settings->ninjaPath.filePath();
environment.appendOrSetPath(ninja.isFile() ? ninja.parentDir() : ninja);
}
cmakeToolId = CMakeKitAspect::cmakeToolId(k);
}

View File

@@ -1714,6 +1714,15 @@ FilePath CMakeBuildConfiguration::sourceDirectory() const
return aspect<SourceDirectoryAspect>()->filePath();
}
void CMakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
CMakeSpecificSettings *settings = CMakeProjectPlugin::projectTypeSpecificSettings();
if (!settings->ninjaPath.filePath().isEmpty()) {
const Utils::FilePath ninja = settings->ninjaPath.filePath();
env.appendOrSetPath(ninja.isFile() ? ninja.parentDir() : ninja);
}
}
QString CMakeBuildSystem::cmakeBuildType() const
{
auto setBuildTypeFromConfig = [this](const CMakeConfig &config) {

View File

@@ -64,6 +64,8 @@ public:
void setSourceDirectory(const Utils::FilePath& path);
Utils::FilePath sourceDirectory() const;
void addToEnvironment(Utils::Environment &env) const override;
signals:
void signingFlagsChanged();