forked from qt-creator/qt-creator
QbsProjectManager: Set cpp.compilerPathByLanguage.
To work around the "-x" bug in icecream. Change-Id: I7d95aa120ad344f6662c265fe81ab98752c7cd1e Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <qbs.h>
|
||||
@@ -231,6 +232,29 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
data.insert(QLatin1String(CPP_LINKERNAME), compilerName);
|
||||
}
|
||||
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath());
|
||||
|
||||
QVariantMap m;
|
||||
if (toolchain.contains(QLatin1String("clang"))) {
|
||||
m[QLatin1String("c")] = m[QLatin1String("objc")] = QLatin1String("clang");
|
||||
m[QLatin1String("cpp")] = m[QLatin1String("objcpp")] = QLatin1String("clang++");
|
||||
} else if (toolchain.contains(QLatin1String("gcc"))) {
|
||||
m[QLatin1String("c")] = m[QLatin1String("objc")] = QLatin1String("gcc");
|
||||
m[QLatin1String("cpp")] = m[QLatin1String("objcpp")] = QLatin1String("g++");
|
||||
}
|
||||
const QString fullPrefix = cxxFileInfo.absolutePath() + QLatin1Char('/') + toolchainPrefix;
|
||||
for (auto it = m.begin(); it != m.end();) {
|
||||
const QString filePath = Utils::HostOsInfo::withExecutableSuffix(fullPrefix
|
||||
+ it.value().toString());
|
||||
if (QFile::exists(filePath)) {
|
||||
it.value() = filePath;
|
||||
++it;
|
||||
} else {
|
||||
it = m.erase(it);
|
||||
}
|
||||
}
|
||||
if (!m.isEmpty())
|
||||
data.insert(QLatin1String(CPP_COMPILERPATHBYLANGUAGE), m);
|
||||
|
||||
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2013Flavor) {
|
||||
const QLatin1String flags("/FS");
|
||||
data.insert(QLatin1String(CPP_PLATFORMCFLAGS), flags);
|
||||
|
@@ -41,6 +41,7 @@ const char QBS_ARCHITECTURE[] = "qbs.architecture";
|
||||
const char QBS_ENDIANNESS[] = "qbs.endianness";
|
||||
const char QBS_TOOLCHAIN[] = "qbs.toolchain";
|
||||
const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath";
|
||||
const char CPP_COMPILERPATHBYLANGUAGE[] = "cpp.compilerPathByLanguage";
|
||||
const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix";
|
||||
const char CPP_COMPILERNAME[] = "cpp.compilerName";
|
||||
const char CPP_LINKERNAME[] = "cpp.linkerName";
|
||||
|
Reference in New Issue
Block a user