move cachefile_depth calculation out of project evaluator
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Tue, 12 Jun 2012 18:15:41 +0000 (20:15 +0200)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Wed, 27 Jun 2012 12:35:33 +0000 (14:35 +0200)
it has no business there

Change-Id: I6d1a4b55b5acacc470cc109a6c69a907abbba312
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
qmake/option.cpp
qmake/project.cpp
qmake/project.h

index b2f5de5..b01b4ed 100644 (file)
@@ -556,6 +556,11 @@ bool Option::postProcessProject(QMakeProject *project)
     Option::lex_mod = project->first("QMAKE_MOD_LEX");
     Option::yacc_mod = project->first("QMAKE_MOD_YACC");
     Option::dir_sep = project->first("QMAKE_DIR_SEP");
+
+    if (Option::output_dir.startsWith(project->buildRoot()))
+        Option::mkfile::cachefile_depth =
+                Option::output_dir.mid(project->buildRoot().length()).count('/');
+
     return true;
 }
 
index 928ecc9..8b15153 100644 (file)
@@ -1333,9 +1333,9 @@ QMakeProject::read(uchar cmd)
       if (base_vars.isEmpty()) {
         QString superdir;
         QString project_root;
-        QString project_build_root;
         QStringList qmakepath;
         QStringList qmakefeatures;
+        project_build_root.clear();
         if (Option::mkfile::do_cache) {        // parse the cache
             QHash<QString, QStringList> cache;
             QString rdir = Option::output_dir;
@@ -1403,10 +1403,6 @@ QMakeProject::read(uchar cmd)
             qmakepath = cache.value(QLatin1String("QMAKEPATH"));
             qmakefeatures = cache.value(QLatin1String("QMAKEFEATURES"));
 
-            if (Option::output_dir.startsWith(project_build_root))
-                Option::mkfile::cachefile_depth =
-                        Option::output_dir.mid(project_build_root.length()).count('/');
-
             if (!superfile.isEmpty())
                 vars["_QMAKE_SUPER_CACHE_"] << superfile;
             if (!cachefile.isEmpty())
index cf71e5e..266053a 100644 (file)
@@ -82,6 +82,7 @@ class QMakeProject
     bool need_restart;
     bool own_prop;
     bool backslashWarned;
+    QString project_build_root;
     QString conffile;
     QString superfile;
     QString cachefile;
@@ -136,6 +137,7 @@ public:
     QStringList userTestFunctions() { return testFunctions.keys(); }
 
     QString projectFile();
+    QString buildRoot() const { return project_build_root; }
     QString confFile() const { return conffile; }
     QString cacheFile() const { return cachefile; }
     QString specDir() const { return real_spec; }