forked from qt-creator/qt-creator
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: Robert Loehning <robert.loehning@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -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"); });
|
||||
|
||||
Reference in New Issue
Block a user