diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-08-06 13:47:18 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-08-08 05:12:44 +0000 |
commit | 7dc930d40037c99d87b09de09a882d5f86f157d5 (patch) | |
tree | 4fb2d701078c70b24015b90f2412ded16f8b23f6 /qmake | |
parent | bedf50a5bb9656a64ec609536366f90929a63c39 (diff) |
qmake vcxproj generator: Fix compilation of generated C++ sources
Generated C++ source files with extensions other than .cpp would not get
compiled, because the code ignored all other C++ source extensions like
.cc and .cxx.
Fix this by respecting the value of QMAKE_EXT_CPP and QMAKE_EXT_C.
Task-number: QTBUG-69770
Change-Id: I097dfef6920e353a351c97891cdbfdc9a859815f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake')
-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); |