forked from qt-creator/qt-creator
CMakePM: Proper handling of the extra generator
CMake fails if it has -DCMAKE_GENERATOR:STRING=CodeBlocks - Ninja It expects separate values: -DCMAKE_EXTRA_GENERATOR:STRING=CodeBlocks -DCMAKE_GENERATOR:STRING=Ninja Fixes: QTCREATORBUG-27060 Change-Id: Ia2b5bdc425e569118d689b7223fbef5f953d98a7 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1739,8 +1739,22 @@ void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringLis
|
|||||||
{
|
{
|
||||||
QStringList arguments = values.split('\n', Qt::SkipEmptyParts);
|
QStringList arguments = values.split('\n', Qt::SkipEmptyParts);
|
||||||
for (QString &arg: arguments) {
|
for (QString &arg: arguments) {
|
||||||
if (arg.startsWith("-G"))
|
if (arg.startsWith("-G")) {
|
||||||
|
const QString strDash(" - ");
|
||||||
|
const int idxDash = arg.indexOf(strDash);
|
||||||
|
if (idxDash > 0) {
|
||||||
|
// -GCodeBlocks - Ninja
|
||||||
|
QString generator = "-DCMAKE_GENERATOR:STRING=" + arg.mid(idxDash + strDash.length());
|
||||||
|
arguments.append(generator);
|
||||||
|
|
||||||
|
arg = arg.first(idxDash);
|
||||||
|
arg.replace("-G", "-DCMAKE_EXTRA_GENERATOR:STRING=");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// -GNinja
|
||||||
arg.replace("-G", "-DCMAKE_GENERATOR:STRING=");
|
arg.replace("-G", "-DCMAKE_GENERATOR:STRING=");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (arg.startsWith("-A"))
|
if (arg.startsWith("-A"))
|
||||||
arg.replace("-A", "-DCMAKE_GENERATOR_PLATFORM:STRING=");
|
arg.replace("-A", "-DCMAKE_GENERATOR_PLATFORM:STRING=");
|
||||||
if (arg.startsWith("-T"))
|
if (arg.startsWith("-T"))
|
||||||
|
@@ -668,11 +668,10 @@ CMakeConfig CMakeGeneratorKitAspect::generatorCMakeConfig(const ProjectExplorer:
|
|||||||
if (info.generator.isEmpty())
|
if (info.generator.isEmpty())
|
||||||
return config;
|
return config;
|
||||||
|
|
||||||
if (info.extraGenerator.isEmpty())
|
|
||||||
config << CMakeConfigItem("CMAKE_GENERATOR", info.generator.toUtf8());
|
config << CMakeConfigItem("CMAKE_GENERATOR", info.generator.toUtf8());
|
||||||
else
|
|
||||||
config << CMakeConfigItem("CMAKE_GENERATOR",
|
if (!info.extraGenerator.isEmpty())
|
||||||
(info.extraGenerator + " - " + info.generator).toUtf8());
|
config << CMakeConfigItem("CMAKE_EXTRA_GENERATOR", info.extraGenerator.toUtf8());
|
||||||
|
|
||||||
if (!info.platform.isEmpty())
|
if (!info.platform.isEmpty())
|
||||||
config << CMakeConfigItem("CMAKE_GENERATOR_PLATFORM", info.platform.toUtf8());
|
config << CMakeConfigItem("CMAKE_GENERATOR_PLATFORM", info.platform.toUtf8());
|
||||||
|
Reference in New Issue
Block a user