forked from qt-creator/qt-creator
CMakePM: Better error message when CMake file-api config is missing
Now the available configuration list is displayed, alongside with the hint that CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES needs to match / contain the "Build type" field. In order to test this just clear (or set a random value) in the "Build type" field and click "Re-configure with initial parameters" button. Fixes: QTCREATORBUG-25506 Change-Id: I44558c45c7050d03e72a3a0b9ce2c8d89bd6e4bc Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -896,7 +896,21 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri
|
|||||||
return QString::compare(cfg.name, cmakeBuildType, Qt::CaseInsensitive) == 0;
|
return QString::compare(cfg.name, cmakeBuildType, Qt::CaseInsensitive) == 0;
|
||||||
});
|
});
|
||||||
if (it == codeModels.cend()) {
|
if (it == codeModels.cend()) {
|
||||||
errorMessage = QString("No '%1' CMake configuration found!").arg(cmakeBuildType);
|
QStringList buildTypes;
|
||||||
|
for (const Configuration &cfg: codeModels)
|
||||||
|
buildTypes << cfg.name;
|
||||||
|
|
||||||
|
if (result.replyFile.isMultiConfig) {
|
||||||
|
errorMessage = tr("No \"%1\" CMake configuration found. Available configurations: \"%2\".\n"
|
||||||
|
"Make sure that CMAKE_CONFIGURATION_TYPES variable contains the \"Build type\" field.")
|
||||||
|
.arg(cmakeBuildType)
|
||||||
|
.arg(buildTypes.join(", "));
|
||||||
|
} else {
|
||||||
|
errorMessage = tr("No \"%1\" CMake configuration found. Available configuration: \"%2\".\n"
|
||||||
|
"Make sure that CMAKE_BUILD_TYPE variable matches the \"Build type\" field.")
|
||||||
|
.arg(cmakeBuildType)
|
||||||
|
.arg(buildTypes.join(", "));
|
||||||
|
}
|
||||||
qWarning() << errorMessage;
|
qWarning() << errorMessage;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -245,6 +245,7 @@ public:
|
|||||||
|
|
||||||
class FileApiParser
|
class FileApiParser
|
||||||
{
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(FileApiParser)
|
||||||
public:
|
public:
|
||||||
static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType,
|
static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType,
|
||||||
QString &errorMessage);
|
QString &errorMessage);
|
||||||
|
Reference in New Issue
Block a user