CMakePM: Use same detection mechanism for ninja as done for cmake

Qt Creator looks into 3rd party package managers when doing the CMake
autodetection on macOS (homebrew, macports etc.).

The CMake installed from a 3rd party package would find ninja by itself,
so we need to take this into consideration.

Fixes: QTCREATORBUG-32331
Change-Id: I4e2a09b913c5295e9afe9f6c0ee9321f1d1c84c6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Cristian Adam
2025-03-29 09:17:49 +01:00
parent f9482a62b4
commit 449f3b94f0

View File

@@ -708,8 +708,12 @@ bool CMakeGeneratorKitAspectFactory::isNinjaPresent(const Kit *k, const CMakeToo
return true;
if (Internal::settings(nullptr).ninjaPath().isEmpty()) {
auto findNinja = [](const Environment &env) -> bool {
return !env.searchInPath("ninja").isEmpty();
FilePaths extraDirs;
if (tool->filePath().osType() == OsTypeMac)
extraDirs << tool->filePath().parentDir();
auto findNinja = [extraDirs](const Environment &env) -> bool {
return !env.searchInPath("ninja", extraDirs).isEmpty();
};
if (!findNinja(tool->filePath().deviceEnvironment()))
return findNinja(k->buildEnvironment());