diff --git a/src/plugins/baremetal/iarewtoolchain.cpp b/src/plugins/baremetal/iarewtoolchain.cpp index 396196b151c..ba9e5204b31 100644 --- a/src/plugins/baremetal/iarewtoolchain.cpp +++ b/src/plugins/baremetal/iarewtoolchain.cpp @@ -66,6 +66,16 @@ static bool compilerExists(const FilePath &compilerPath) return fi.exists() && fi.isExecutable() && fi.isFile(); } +static QString cppLanguageOption(const FilePath &compiler) +{ + const QString baseName = compiler.toFileInfo().baseName(); + if (baseName == "iccarm") + return "--c++"; + if (baseName == "icc8051" || baseName == "iccavr") + return "--ec++"; + return {}; +} + static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id languageId, const QStringList &env) { @@ -88,7 +98,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang QStringList arguments; arguments.push_back(fakeIn.fileName()); if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) - arguments.push_back("--c++"); + arguments.push_back(cppLanguageOption(compiler)); arguments.push_back("--predef_macros"); arguments.push_back(outpath); @@ -134,7 +144,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang QStringList arguments; arguments.push_back(fakeIn.fileName()); if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) - arguments.push_back("--c++"); + arguments.push_back(cppLanguageOption(compiler)); arguments.push_back("--preinclude"); arguments.push_back(".");