forked from qt-creator/qt-creator
CMake: Improve default generator setup on Windows
If ninja is not an option on windows: Pick mingw makefile generator for kits with a Mingw toolchain on windows and the nmake makefile generator for other toolchains on windows. On Unix fall back to the Unix makefiles generator if ninja is unavailable as we did before. Change-Id: I8005615e6f725d38c16c1b9026d3f7548e7b42db 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:
@@ -176,12 +176,25 @@ QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const
|
|||||||
if (ninjaExec.isEmpty())
|
if (ninjaExec.isEmpty())
|
||||||
it = known.constEnd(); // Ignore ninja generator without ninja exectuable
|
it = known.constEnd(); // Ignore ninja generator without ninja exectuable
|
||||||
}
|
}
|
||||||
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
|
// *sigh* Windows with its zoo of incompatible stuff again...
|
||||||
|
ToolChain *tc = ToolChainKitInformation::toolChain(k);
|
||||||
|
if (tc && tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID) {
|
||||||
if (it == known.constEnd())
|
if (it == known.constEnd())
|
||||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||||
[](const QString &s) { return s == QLatin1String("CodeBlocks - Unix Makefiles"); });
|
[](const QString &s) { return s == QLatin1String("CodeBlocks - MinGW Makefiles"); });
|
||||||
|
} else {
|
||||||
if (it == known.constEnd())
|
if (it == known.constEnd())
|
||||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||||
[](const QString &s) { return s == QLatin1String("CodeBlocks - NMake Makefiles"); });
|
[](const QString &s) { return s == QLatin1String("CodeBlocks - NMake Makefiles"); });
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Unix-oid OSes:
|
||||||
|
if (it == known.constEnd())
|
||||||
|
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||||
|
[](const QString &s) { return s == QLatin1String("CodeBlocks - Unix Makefiles"); });
|
||||||
|
}
|
||||||
if (it == known.constEnd())
|
if (it == known.constEnd())
|
||||||
it = known.constBegin(); // Fallback to the first generator...
|
it = known.constBegin(); // Fallback to the first generator...
|
||||||
if (it != known.constEnd())
|
if (it != known.constEnd())
|
||||||
|
|||||||
Reference in New Issue
Block a user