summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-07-27 12:46:48 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-07-27 12:48:20 (GMT)
commit3fd2f0423bf9affe27c8f1cc801f7ded165f173d (patch)
treefc05ab2d78d4c8c66bbdc640ec57a759090183ed
parent521f9b245330665f114238e1a888161c696fed03 (diff)
downloadQt-3fd2f0423bf9affe27c8f1cc801f7ded165f173d.zip
Qt-3fd2f0423bf9affe27c8f1cc801f7ded165f173d.tar.gz
Qt-3fd2f0423bf9affe27c8f1cc801f7ded165f173d.tar.bz2
Fix qmake dependency generation for include statements with local files.
The header file should be looked up relative to the directory of the compilation unit and not qmake's current directory or the like. Simplified the logic slightly to achieve that. Reviewed-by: João Abecasis <joao@abecasis.name>
-rw-r--r--qmake/generators/makefiledeps.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index 34a5322..d907394 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -378,17 +378,19 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
files_changed = true;
file->dep_checked = true;
+ const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true);
+
struct stat fst;
char *buffer = 0;
int buffer_len = 0;
{
int fd;
#if defined(_MSC_VER) && _MSC_VER >= 1400
- if (_sopen_s(&fd, fixPathForFile(file->file, true).local().toLatin1().constData(),
+ if (_sopen_s(&fd, sourceFile.local().toLatin1().constData(),
_O_RDONLY, _SH_DENYNO, _S_IREAD) != 0)
fd = -1;
#else
- fd = open(fixPathForFile(file->file, true).local().toLatin1().constData(), O_RDONLY);
+ fd = open(sourceFile.local().toLatin1().constData(), O_RDONLY);
#endif
if(fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode))
return false;
@@ -623,12 +625,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
QMakeLocalFileName lfn(inc);
if(QDir::isRelativePath(lfn.real())) {
if(try_local) {
- QString dir = findFileInfo(file->file).path();
- if(QDir::isRelativePath(dir))
- dir.prepend(qmake_getpwd() + "/");
- if(!dir.endsWith("/"))
- dir += "/";
- QMakeLocalFileName f(dir + lfn.local());
+ QDir sourceDir = findFileInfo(sourceFile).dir();
+ QMakeLocalFileName f(sourceDir.absoluteFilePath(lfn.local()));
if(findFileInfo(f).exists()) {
lfn = fixPathForFile(f);
exists = true;