diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-08-02 13:18:46 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-08-13 09:38:46 +0200 |
commit | 42d32e468aa89631161884f07b3e25814c47b879 (patch) | |
tree | 7c79ea5e74e6e263b0834ba620a3abae9de9562c /qmake/generators/win32 | |
parent | 00076a2695ddf429f478b43472b742921288bba0 (diff) |
Determine dependencies of Windows resource files
Windows resource files support a subset of C preprocessor directives.
Among others they can have #include directives.
Use QMake's own scanner to retrieve the files that are included by a
Windows resource file and add them to its dependencies.
For the test case the TestCompiler class had to be extended:
runCommand is now public, and commandOutput is less peculiar.
Fixes: QTBUG-3859
Change-Id: I138703352c37c98297c0574a9a440510c1c494b8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 6 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 40114948c2..878291fae9 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -342,7 +342,11 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) if (defines.isEmpty()) defines = ProString(" $(DEFINES)"); - t << escapeDependencyPath(var("RES_FILE")) << ": " << escapeDependencyPath(rc_file) << "\n\t" + addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS); + const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file); + + t << escapeDependencyPath(var("RES_FILE")) << ": " + << escapeDependencyPaths(rcDeps).join(' ') << "\n\t" << var("QMAKE_RC") << " -i " << escapeFilePath(rc_file) << " -o " << fileVar("RES_FILE") << incPathStr << defines << "\n\n"; } diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 392d825f5b..27d2a7c0a5 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -667,6 +667,9 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) incPathStr += escapeFilePath(path); } + addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS); + const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file); + // The resource tool may use defines. This might be the same defines passed in as the // compiler, since you may use these defines in the .rc file itself. // As the escape syntax for the command line defines for RC is different from that for CL, @@ -678,7 +681,8 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) // Also, we need to add the _DEBUG define manually since the compiler defines this symbol // by itself, and we use it in the automatically created rc file when VERSION is defined // in the .pro file. - t << escapeDependencyPath(res_file) << ": " << escapeDependencyPath(rc_file) << "\n\t" + t << escapeDependencyPath(res_file) << ": " + << escapeDependencyPaths(rcDeps).join(' ') << "\n\t" << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << defines << incPathStr << " -fo " << escapeFilePath(res_file) << ' ' << escapeFilePath(rc_file); |