Cmake: Let the generator determine the toolchain

Otherwise we need to parse the cbp file, which happens only if the
buildconfiguration gets active. Also try to decouple a few internals a
little bit by using signals. The CMakeProject still handles a few things
directly instead of via signals, more to come eventually.
This commit is contained in:
dt
2009-12-03 19:45:09 +01:00
parent 1e46cb424e
commit 24a4590767
11 changed files with 111 additions and 46 deletions

View File

@@ -110,8 +110,6 @@ QString CMakeBuildConfiguration::buildDirectory() const
QString CMakeBuildConfiguration::buildParser() const
{
// TODO this is actually slightly wrong, but do i care?
// this should call toolchain(configuration)
if (!m_toolChain)
return QString::null;
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
@@ -134,22 +132,21 @@ ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
{
updateToolChain();
return m_toolChain;
}
void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
void CMakeBuildConfiguration::updateToolChain() const
{
//qDebug()<<"CodeBlocks Compilername"<<compiler
ProjectExplorer::ToolChain *newToolChain = 0;
if (compiler == "gcc") {
if (msvcVersion().isEmpty()) {
#ifdef Q_OS_WIN
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
#else
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
#endif
} else if (compiler == "msvc8") {
} else { // msvc
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
} else {
}
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
@@ -161,5 +158,26 @@ void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
}
}
void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
{
if (value("buildDirectory") == buildDirectory)
return;
setValue("buildDirectory", buildDirectory);
emit buildDirectoryChanged();
}
QString CMakeBuildConfiguration::msvcVersion() const
{
return value("msvcVersion").toString();
}
void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
{
if (value("msvcVersion").toString() == msvcVersion)
return;
setValue("msvcVersion", msvcVersion);
updateToolChain();
emit msvcVersionChanged();
}