CMakeProjectManager: Support for multi-config generators

CMake has multi-config generators like:

  * Visual Studio
  * Xcode
  * Ninja Multi-Config

The first two have different special targets for "all", "install",
"package", "test" namely: "ALL_BUILD", "INSTALL", "PACKAGE",
"RUN_TESTS".

All of them need to get the build type passed via "--config <build-
type>" and not via "CMAKE_BUILD_TYPE".

The multi-config generators will use only one build directory.

Fixes: QTCREATORBUG-24984
Change-Id: I8aa7ff73ce2af1e163b21a6504d26fcf95530edf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2021-01-14 16:38:55 +01:00
parent f3d7717b31
commit 6cbdae8070
22 changed files with 238 additions and 140 deletions

View File

@@ -59,8 +59,6 @@ CMakeManager::CMakeManager()
, m_clearCMakeCacheAction(new QAction(QIcon(), tr("Clear CMake Configuration"), this))
, m_runCMakeActionContextMenu(new QAction(QIcon(), tr("Run CMake"), this))
, m_rescanProjectAction(new QAction(QIcon(), tr("Rescan Project"), this))
, m_parseAndValidateCMakeReplyFileAction(
new QAction(QIcon(), tr("Parse and verify a CMake reply file."), this))
{
Core::ActionContainer *mbuild =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
@@ -132,13 +130,6 @@ CMakeManager::CMakeManager()
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); });
command = Core::ActionManager::registerAction(m_parseAndValidateCMakeReplyFileAction,
"CMakeProject.Debug.ParseAndVerifyReplyFile");
connect(m_parseAndValidateCMakeReplyFileAction,
&QAction::triggered,
this,
&CMakeManager::parseAndValidateCMakeReplyFile);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &CMakeManager::updateCmakeActions);
connect(BuildManager::instance(), &BuildManager::buildStateChanged,
@@ -227,29 +218,6 @@ void CMakeManager::enableBuildFileMenus(Node *node)
}
}
void CMakeManager::parseAndValidateCMakeReplyFile()
{
QString replyFile = QFileDialog::getOpenFileName(Core::ICore::mainWindow(),
tr("Select a CMake Reply File"),
QString(),
QString("index*.json"));
if (replyFile.isEmpty())
return;
QString errorMessage;
auto result = FileApiParser::parseData(QFileInfo(replyFile), errorMessage);
const QString message
= errorMessage.isEmpty()
? tr("The reply file \"%1\" and referenced data parsed OK and passed validation.")
.arg(QDir::toNativeSeparators(replyFile))
: tr("The reply file \"%1\" failed to parse or validate with error "
"message:<br><b>\"%2\"</b>")
.arg(QDir::toNativeSeparators(replyFile))
.arg(errorMessage);
QMessageBox::information(Core::ICore::mainWindow(), tr("Parsing Result"), message);
}
void CMakeManager::buildFile(Node *node)
{
if (!node) {