Commit 869c4622 authored by Tobias Hunger's avatar Tobias Hunger

CMake: Only use ninja if that is found in PATH

Only use ninja by default if that is found in PATH. Still prefer ninja
if it is available as that apparently is a huge time saver, especially
on windows.

Change-Id: Iadaecbaddfe6592222f2ed5e42b440665e9246a7
Task-number: QTCREATORBUG-15756
Reviewed-by: default avatarRobert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 925492a1
......@@ -36,6 +36,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
......@@ -168,6 +169,13 @@ QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const
QStringList known = tool->supportedGenerators();
auto it = std::find_if(known.constBegin(), known.constEnd(),
[](const QString &s) { return s == QLatin1String("CodeBlocks - Ninja"); });
if (it != known.constEnd()) {
Utils::Environment env = Utils::Environment::systemEnvironment();
k->addToEnvironment(env);
const Utils::FileName ninjaExec = env.searchInPath(QLatin1String("ninja"));
if (ninjaExec.isEmpty())
it = known.constEnd(); // Ignore ninja generator without ninja exectuable
}
if (it == known.constEnd())
it = std::find_if(known.constBegin(), known.constEnd(),
[](const QString &s) { return s == QLatin1String("CodeBlocks - Unix Makefiles"); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment