summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-29 15:10:35 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-12 10:00:37 (GMT)
commit8caba032245dfa310a77c22c1e55137c54e59f4f (patch)
tree0259b7bf50577f1d161f245e2bbe60cdf235c3e9 /qmake/generators/win32
parenta5be47714e5a0075fe9d0ea4a7925136a48e3974 (diff)
downloadQt-8caba032245dfa310a77c22c1e55137c54e59f4f.zip
Qt-8caba032245dfa310a77c22c1e55137c54e59f4f.tar.gz
Qt-8caba032245dfa310a77c22c1e55137c54e59f4f.tar.bz2
make collection of SUBDIRS in solution generator less bizarre
de-duplicate code, and on the way don't try to re-resolve project variables of subprojects against the contents of the top level project. Reviewed-by: mariusSO
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp42
-rw-r--r--qmake/generators/win32/msvc_vcproj.h1
2 files changed, 22 insertions, 21 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 10934a5..5005190 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -352,6 +352,25 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id)
return result;
}
+QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj)
+{
+ QStringList subdirs;
+ QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"];
+ for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
+ QString tmpdir = tmp_proj_subdirs.at(x);
+ if(!proj->isEmpty(tmpdir + ".file")) {
+ if(!proj->isEmpty(tmpdir + ".subdir"))
+ warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
+ tmpdir.toLatin1().constData());
+ tmpdir = proj->first(tmpdir + ".file");
+ } else if(!proj->isEmpty(tmpdir + ".subdir")) {
+ tmpdir = proj->first(tmpdir + ".subdir");
+ }
+ subdirs += tmpdir;
+ }
+ return subdirs;
+}
+
void VcprojGenerator::writeSubDirs(QTextStream &t)
{
// Check if all requirements are fulfilled
@@ -386,7 +405,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QHash<QString, VcsolutionDepend*> solution_depends;
QList<VcsolutionDepend*> solution_cleanup;
- QStringList subdirs = project->values("SUBDIRS");
QString oldpwd = qmake_getpwd();
// Make sure that all temp projects are configured
@@ -395,16 +413,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QStringList old_after_vars = Option::after_user_vars;
Option::after_user_vars.append("CONFIG+=release");
+ QStringList subdirs = collectSubDirs(project);
for(int i = 0; i < subdirs.size(); ++i) {
QString tmp = subdirs.at(i);
- if(!project->isEmpty(tmp + ".file")) {
- if(!project->isEmpty(tmp + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmp.toLatin1().constData());
- tmp = project->first(tmp + ".file");
- } else if(!project->isEmpty(tmp + ".subdir")) {
- tmp = project->first(tmp + ".subdir");
- }
QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true)));
if(fi.exists()) {
if(fi.isDir()) {
@@ -428,19 +439,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
continue;
}
if(tmp_proj.first("TEMPLATE") == "vcsubdirs") {
- QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"];
- for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
- QString tmpdir = tmp_proj_subdirs.at(x);
- if(!tmp_proj.isEmpty(tmpdir + ".file")) {
- if(!tmp_proj.isEmpty(tmpdir + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmpdir.toLatin1().constData());
- tmpdir = tmp_proj.first(tmpdir + ".file");
- } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) {
- tmpdir = tmp_proj.first(tmpdir + ".subdir");
- }
+ foreach(const QString &tmpdir, collectSubDirs(&tmp_proj))
subdirs += fileFixify(tmpdir);
- }
} else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
// Initialize a 'fake' project to get the correct variables
// and to be able to extract all the dependencies
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 8e55211..d66c029 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -130,6 +130,7 @@ protected:
QList<VcprojGenerator*> mergedProjects;
private:
+ QStringList collectSubDirs(QMakeProject *proj);
QUuid increaseUUID(const QUuid &id);
friend class VCFilter;
};