diff options
author | Andy Shaw <andy.shaw@digia.com> | 2013-08-07 09:09:13 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-03 08:23:08 +0200 |
commit | 0278310f9e27b1c6aca6bd70dc5415a240cd33c3 (patch) | |
tree | 779e1b3dd2e31b9be21ff9d3be545a8dd45ee7d6 /qmake | |
parent | 0ed30cbf09db591b46370888fa2f687310bf5cff (diff) |
Ensure the input file is first in the list of dependencies
When building a project in VS then it would cause a rebuild
under certain situations even though a rebuild is not
actually required.
The root problem exists in VS in the following configuration:
1. A file has a custom build tool specified
2. The custom build tool has additional dependencies
3. The input file is specified in the additional dependencies
4. There are files in the additional dependency list
This is the situation with form files in Qt that have include hints
specified in Qt Designer. The include hints get specified in the
additional dependencies for the custom build tool.
What happens is that VS will process files in the additional
dependency list differently based on where they appear in the list
relative to the input file.
If a dependency appears before the input file, VS will require the
file as a build input. If you just specify a file name, VS looks in
the project directory (and only the project directory) for that file.
You have to specify the path (relative or absolute) to get VS to look
elsewhere. If VS does not find the dependency, VS thinks the project
is out of date (since the missing dependency is a required build
input) and will rebuild the input file.
If the dependency appears after the input file and the file doesn't
exist, VS does not include the dependency as a build input. Since the
file is not a build input, no rebuild is required.
Change-Id: I5af460d21ad049ed7819746fd60c98677b810692
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 8c25ab6f9b..d6d40bcc68 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2311,7 +2311,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) inputs += Option::fixPathToTargetOS(file, false); } } - deps += inputs; // input files themselves too.. + deps = inputs + deps; // input files themselves too.. // Replace variables for command w/all input files // ### join gives path issues with directories containing spaces! @@ -2319,7 +2319,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) inputs.join(' '), out); } else { - deps += inFile; // input file itself too.. + deps.prepend(inFile); // input file itself too.. cmd = Project->replaceExtraCompilerVariables(tmp_cmd, inFile, out); @@ -2356,14 +2356,14 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) deps += CustomBuildTool.AdditionalDependencies; // Make sure that all deps are only once - QHash<QString, bool> uniqDeps; + QStringList uniqDeps; for (int c = 0; c < deps.count(); ++c) { QString aDep = deps.at(c).trimmed(); if (!aDep.isEmpty()) - uniqDeps[aDep] = false; + uniqDeps << aDep; } - CustomBuildTool.AdditionalDependencies = uniqDeps.keys(); - CustomBuildTool.AdditionalDependencies.sort(); + uniqDeps.removeDuplicates(); + CustomBuildTool.AdditionalDependencies = uniqDeps; } // Ensure that none of the output files are also dependencies. Or else, the custom buildstep |