forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.8'
Conflicts: src/plugins/cpptools/compileroptionsbuilder.cpp Change-Id: I522f91de70aff28692d7c3a050e8d52df0b82a76
This commit is contained in:
@@ -404,16 +404,20 @@ static QByteArray msCompatibilityVersionFromDefines(const ProjectExplorer::Macro
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QByteArray CompilerOptionsBuilder::msvcVersion() const
|
||||
{
|
||||
const QByteArray version = msCompatibilityVersionFromDefines(m_projectPart.toolChainMacros);
|
||||
return !version.isEmpty() ? version
|
||||
: msCompatibilityVersionFromDefines(m_projectPart.projectMacros);
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addMsvcCompatibilityVersion()
|
||||
{
|
||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID
|
||||
|| m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) {
|
||||
const ProjectExplorer::Macros macros = m_projectPart.toolChainMacros
|
||||
+ m_projectPart.projectMacros;
|
||||
const QByteArray msvcVersion = msCompatibilityVersionFromDefines(macros);
|
||||
|
||||
if (!msvcVersion.isEmpty())
|
||||
add(QLatin1String("-fms-compatibility-version=") + msvcVersion);
|
||||
const QByteArray msvcVer = msvcVersion();
|
||||
if (!msvcVer.isEmpty())
|
||||
add(QLatin1String("-fms-compatibility-version=") + msvcVer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,16 +603,21 @@ void CompilerOptionsBuilder::addProjectConfigFileInclude()
|
||||
void CompilerOptionsBuilder::undefineClangVersionMacrosForMsvc()
|
||||
{
|
||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
|
||||
static const QStringList macroNames {
|
||||
"__clang__",
|
||||
"__clang_major__",
|
||||
"__clang_minor__",
|
||||
"__clang_patchlevel__",
|
||||
"__clang_version__"
|
||||
};
|
||||
const QByteArray msvcVer = msvcVersion();
|
||||
if (msvcVer.toFloat() < 14.f) {
|
||||
// Original fix was only for msvc 2013 (version 12.0)
|
||||
// Undefying them for newer versions is not necessary and breaks boost.
|
||||
static const QStringList macroNames {
|
||||
"__clang__",
|
||||
"__clang_major__",
|
||||
"__clang_minor__",
|
||||
"__clang_patchlevel__",
|
||||
"__clang_version__"
|
||||
};
|
||||
|
||||
for (const QString ¯oName : macroNames)
|
||||
add(undefineOption + macroName);
|
||||
for (const QString ¯oName : macroNames)
|
||||
add(undefineOption + macroName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ private:
|
||||
const QString m_clangVersion;
|
||||
const QString m_clangResourceDirectory;
|
||||
|
||||
QByteArray msvcVersion() const;
|
||||
|
||||
QStringList m_options;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user