Fix inclusion of .qmake.cache for modules with config tests.
authorAaron McCarthy <aaron.mccarthy@nokia.com>
Tue, 30 Aug 2011 00:50:55 +0000 (10:50 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Sep 2011 03:36:26 +0000 (05:36 +0200)
Qt modules with config tests generate a module level .qmake.cache with
the results of the config tests.  The existance of this file prevents
qmake from walking up the directory tree and finding the Qt global
cache file.  This results in the system build not working as expected.
For example running 'make' in the module would only build the contents
of src and skip tests and examples.

Fixed by adding a include statement to the end of the config test
generated .qmake.cache.

Change-Id: I68a5f2a96f4ee02076b6457ae085f45d894cd4ed
Reviewed-on: http://codereview.qt.nokia.com/3830
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
bin/qtmodule-configtests

index ab03908..4b4c5ae 100755 (executable)
@@ -299,9 +299,10 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
         # Generate the new contents
         my $newContents = $existingContents;
 
-        # Strip out any existing config test results
-        $newContents =~ s/^config_test_.*$//gms;
-        $newContents =~ s/^# Compile time test results.*$//gms;
+        # Strip out any existing config test results or include statements
+        $newContents =~ s/^config_test_[^\$]*$//gm;
+        $newContents =~ s/^# Compile time test results[^\$]*$//gm;
+        $newContents =~ s/include\(\$\$PWD\/..\/.qmake.cache\)$//gm;
 
         # Add any remaining content and make sure we start on a new line
         if ($newContents and chop $newContents ne '\n') {
@@ -318,6 +319,12 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
             }
         }
 
+        # Remove blank lines
+        $newContents =~ s/^[\s]*$//gms;
+
+        # Include top level .qmake.cache
+        $newContents = $newContents . "include(\$\$PWD/../.qmake.cache)\n";
+
         # and open the file
         open my $cacheFileHandle, ">$qmakeCachePath" or die "Unable to open $qmakeCachePath for writing: $!\n";