forked from qt-creator/qt-creator
CMake: Do not create .cmake directories in source dir
Only initialize the CMakeBuildSystem after the CMakeBuildConfiguration has been fully set up. The "builddirectory" was still pointing to the source directory, so creater configured cmake in the source directory, leading to a useless directory being left in the source tree that does not belong there. Fixes: QTCREATORBUG-23816 Change-Id: I7c9b6ae1f8d999043e700cd9f2d56418c22f2abf Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -70,7 +70,6 @@ const char CONFIGURATION_KEY[] = "CMake.Configuration";
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Core::Id id)
|
||||
: BuildConfiguration(target, id)
|
||||
{
|
||||
m_buildSystem = new CMakeBuildSystem(this);
|
||||
setBuildDirectory(shadowBuildDirectory(project()->projectFilePath(),
|
||||
target->kit(),
|
||||
displayName(),
|
||||
@@ -157,6 +156,9 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Core::Id id)
|
||||
}
|
||||
|
||||
setConfigurationForCMake(config);
|
||||
|
||||
// Only do this after everything has been set up!
|
||||
m_buildSystem = new CMakeBuildSystem(this);
|
||||
});
|
||||
|
||||
const auto qmlDebuggingAspect = addAspect<QtSupport::QmlDebuggingAspect>();
|
||||
@@ -164,6 +166,11 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Core::Id id)
|
||||
connect(qmlDebuggingAspect, &QtSupport::QmlDebuggingAspect::changed,
|
||||
this, &CMakeBuildConfiguration::configurationForCMakeChanged);
|
||||
|
||||
// m_buildSystem is still nullptr here since it the build directory to be available
|
||||
// before it can get created.
|
||||
//
|
||||
// This means this needs to be done in the lambda for the setInitializer(...) call
|
||||
// defined above as well as in fromMap!
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||
@@ -182,6 +189,8 @@ QVariantMap CMakeBuildConfiguration::toMap() const
|
||||
|
||||
bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
QTC_CHECK(!m_buildSystem);
|
||||
|
||||
if (!BuildConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
@@ -192,6 +201,8 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
setConfigurationForCMake(conf);
|
||||
|
||||
m_buildSystem = new CMakeBuildSystem(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -214,10 +214,6 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to initial CMake BuildSystem setup";
|
||||
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration),
|
||||
BuildDirManager::REPARSE_CHECK_CONFIGURATION);
|
||||
}
|
||||
|
||||
CMakeBuildSystem::~CMakeBuildSystem()
|
||||
|
Reference in New Issue
Block a user