forked from qt-creator/qt-creator
CMakePM: Search after ninja also in system environment
CMakePM was setting the default generator to Ninja if the ninja executable was set in the build environment. This had the side effect of having to instantiate the build environment for Visual C++, which meant running vcvars.bat files. This operation can be costly if clink is also installed in the system. This way the users that have ninja installed via choco, or manually set it path, will not be affected by this delay. Note that this only fixes the issue for the first start of Qt Creator with new settings. Some number from my machine: - with clink 21s - without clink 10s - with this patchset 4s Task-number: QTCREATORBUG-27906 Change-Id: I74d19b08211d93b3962a8877b49a58089310fbd6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -682,8 +682,11 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
|
|||||||
= Internal::CMakeProjectPlugin::projectTypeSpecificSettings();
|
= Internal::CMakeProjectPlugin::projectTypeSpecificSettings();
|
||||||
|
|
||||||
if (settings->ninjaPath.filePath().isEmpty()) {
|
if (settings->ninjaPath.filePath().isEmpty()) {
|
||||||
Environment env = k->buildEnvironment();
|
auto findNinja = [](const Environment &env) -> bool {
|
||||||
return !env.searchInPath("ninja").isEmpty();
|
return !env.searchInPath("ninja").isEmpty();
|
||||||
|
};
|
||||||
|
if (!findNinja(Environment::systemEnvironment()))
|
||||||
|
return findNinja(k->buildEnvironment());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
|
Reference in New Issue
Block a user