Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.3
-
None
-
2.6.35-rc1+ x86_64 GNU/Linux (Debian)
-
78e74249014b152b93dae07bf194b16769016ad0
Description
A period in the path of a file given to the moc generator should not
be used to determine if it is a header file or a source file,
currently it can. This causes problem with build generators like
cmake that use absolute paths and projects that use extension-less
header files, because if there is a period anyplace in the path it
will fail. This is a problem because directories outside of the
source repository can influence the build, even though it might be
working on another system or mysteriously fail after the source was
moved. For example running moc on the following set of files would
give,
/tmp/moc_test/latest/SubListView.h #include present
/tmp/moc_test/ver_1.h/SubListView.h #include present
/tmp/moc_test/ver_2.h/SubListView #include present
/tmp/moc_test/ver_1.b/SubListView #include missing
/tmp/moc_test/ver_1.0/SubListView #include missing
/tmp/moc_test/ver_1/SubListView #include present
When missing the error message is,
"The header file 'SubListView' doesn't include <QObject>."
and it isn't obvious it is a problem with moc.
moc-qt4(1) lists -f is the default for files that match .[hH][^.]* it
doesn't say what happens for files that don't. The current behavior
is if there is a . in the path and it isn't followed by [hH] and isn't
immediately followed by a path separator it doesn't generate the
include. The moc generator needs to only look at periods in the
filename, not the path for determining if it was given a header or a
source file.
This patch changes it to be, only disable the include generation if
there is a dot found after the last path separator (which is -1 if
there isn't one), and not followed by [hH].
See http://qt.gitorious.org/~dfries/qt/dfriess-qt/commits/4.6_moc_dot_autoinclude
for the patch.