From c35f610219b1d09f6d05215a2e2fe4f2f6bd966c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 14 Feb 2011 15:57:01 +0100 Subject: qmake vcproj generator: support PCHs with other extensions than .h Task-number: QTBUG-16639 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 2 +- qmake/option.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 69cfc0d..3253c3b 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2104,7 +2104,7 @@ void VCFilter::modifyPCHstage(QString str) break; } } - bool isHFile = str.endsWith(".h") && (str == Project->precompH); + bool isHFile = Option::hasFileExtension(str, Option::h_ext) && (str == Project->precompH); bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP); if(!isCFile && !isHFile && !isCPPFile) diff --git a/qmake/option.h b/qmake/option.h index e3ddc9a..bc87343 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -139,6 +139,14 @@ struct Option return fixString(in, flags); } + inline static bool hasFileExtension(const QString &str, const QStringList &extensions) + { + foreach (const QString &ext, extensions) + if (str.endsWith(ext)) + return true; + return false; + } + //global qmake mode, can only be in one mode per invocation! enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE, QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY }; @@ -195,7 +203,6 @@ private: inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); } inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); } - // this is a stripped down version of the one found in QtCore class QLibraryInfo { -- cgit v0.12