diff options
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 9f82ce4f8e..e58999bb97 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1977,6 +1977,15 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml return fileAdded; } +static bool isFileClCompatible(const QString &filePath) +{ + auto filePathEndsWith = [&filePath] (const QString &ext) { + return filePath.endsWith(ext, Qt::CaseInsensitive); + }; + return std::any_of(Option::cpp_ext.cbegin(), Option::cpp_ext.cend(), filePathEndsWith) + || std::any_of(Option::c_ext.cbegin(), Option::c_ext.cend(), filePathEndsWith); +} + void VCXProjectWriter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &filePath, const QString &filterName) { @@ -2000,7 +2009,7 @@ void VCXProjectWriter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, << attrTagS("Filter", filterName); xml << tag("ClInclude") << attrTag("Include", nativeFilePath); - } else if (filePath.endsWith(".cpp")) { + } else if (isFileClCompatible(filePath)) { xmlFilter << tag("ClCompile") << attrTag("Include", nativeFilePath) << attrTagS("Filter", filterName); |