Commit Graph

70 Commits

Author SHA1 Message Date
Alex Neundorf acc224005e Automoc: get include dirs without stripping implicit include dirs off
This should finally fix #13667 and #13762.
Instead of adding special handling to guess whether implicit include dirs
may have been removed, simply make it possible to query the include dirs
without removing the implicit ones.

Alex
2012-12-07 21:24:28 +01:00
Brad King 8faf4e9380 Merge topic 'FixAutomocRegression3'
d253657 Automoc: fix regression #13667, broken build in phonon
2012-11-20 11:48:09 -05:00
Alex Neundorf d2536579d5 Automoc: fix regression #13667, broken build in phonon
On some systems, ${QT_INCLUDE_DIR} is reported by gcc as a builtin
include search dir. Some projects use this information to extend
CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES.
In cmake 2.8.10 now the targets are queried for the include directories
they use. When they return the result, the include dirs contained in
CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES have been removed.
In cmake 2.8.9 and below the INCLUDE_DIRECTORIES directory property
was queried, where this had not been stripped.
So, in those projects which modify the implicit include dirs variable,
on systems where ${QT_INCLUDE_DIR} is reported by gcc, this directory,
e.g. /usr/lib/include/qt/, was not given anymore to moc. This made moc
not find required headers, so the build broke.
Simply giving the full CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES to moc
is no solution either, since moc can't handle some of the headers it
finds then (https://bugreports.qt-project.org/browse/QTBUG-28045).
So now cmake checks CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES, and if this
contains ${QT_INCLUDE_DIR}, and the target reports that it uses
${QT_QTCORE_INCLUDE_DIR} but not ${QT_INCLUDE_DIR}, ${QT_INCLUDE_DIR}
is added to the include dirs given to moc.

Alex
2012-11-20 11:46:28 -05:00
Alex Neundorf 3efe1d35f4 Automoc: "inherit" FOLDER target property from target (#13688)
This patch sets the FOLDER target property for the automoc target
to the same value as of the actual target. This organizes the targets
in IDEs with folders better.

Inspired-by: Mike Gelfand

Alex
2012-11-17 18:32:54 +01:00
Alex Neundorf 3446cb514b Automoc: fix #13572: issue with symbolic links
Now automoc always uses GetRealPath() so symbolic links are always
resolved and it doesn't end up with twice the same file, once with the real
path and once with the symlinked path in some setups where the source dir
can be accessed directly and via a symlink

Alex
2012-10-14 21:16:25 +02:00
Stephen Kelly e83cc94dcd Use the cmGeneratorTarget for the include directories API.
Also, no need to get the include directories from the target
beforehand. The local generator does that for us anyway.
2012-09-19 18:45:01 +02:00
Alex Neundorf ea12871241 Automoc: also the makefile-COMPILE_DEFINITIONS
Alex
2012-09-06 22:22:16 +02:00
Alex Neundorf 894e91a945 Automoc: do not use DEFINITIONS, but only COMPILE_DEFINITIONS
The docs say that this is for cmake 2.4 backwards compatibility only,
so we probably don't need to support it.

Alex
2012-09-05 22:13:30 +02:00
Alex Neundorf 825d1abf14 Automoc: fix #13493, use target properties for include dirs
Alex
2012-09-05 21:49:44 +02:00
Alex Neundorf b001b6e129 fix #13494: rerun automoc also if include dirs or moc options change
Until now it was only rerun if the compile definitions changed, but
of course it also has to rerun if the include dirs or moc options
change. Strange that I didn't notice this before...

Alex
2012-08-27 21:39:50 +02:00
Alex Neundorf e4a2d5f9ee automoc: better error handling (#13299)
automoc now fails immediately if moc fails, instead of continuing
and letting the build fail later on.

Alex
2012-06-14 22:27:22 +02:00
Brad King 94de982902 Avoid direct use of std::(o|)stringstream (#13272)
Older C++ compilers do not provide a standard std::stringstream.
Use our compatibility interfaces instead.

Also avoid std::stringstream(openmode) signature.  Our approximate
stringstream implementation provided when the standard one is not
available does not support the openmode argument.
2012-06-12 15:40:24 -04:00
Sean McBride 8a704955e1 automoc: include <unistd.h> on Apple to get pathconf 2012-03-28 15:07:00 -04:00
Alex Neundorf 2066511ca9 automoc: fix #13018, proper cmake escaping to avoid false rebuilds
The variables stored in the AutomocInfo.cmake file were not properly
escaped, so when reading them back they could turn into lists, if they
contained double quotes initially.
This patch fixes this by using cmLocalGenerator::EscapeForCMake() to
escape the variables properly.

Alex
2012-03-26 21:45:27 +02:00
Alex Neundorf e474dcb231 automoc: improved warning message in relaxed mode
Alex
2011-12-14 19:12:15 +01:00
Alex Neundorf 96fc5d5d07 automoc: default to strict mode, use CMAKE_AUTOMOC_RELAXED_MODE
automoc now defaults to strict mode, also with Qt4, i.e. it behaves as
the documentation says by default. I also inverted the switch
CMAKE_AUTOMOC_STRICT_MODE to CMAKE_AUTOMOC_RELAXED_MODE.
Docs and test adapted accordingly.

Alex
2011-12-13 22:11:47 +01:00
David Cole 2d1195123e Merge branch 'master' into AutomocIncludedDotMocFileHandling
Conflicts:
	Source/cmTarget.cxx
2011-12-07 16:29:13 -05:00
Alex Neundorf bc278ceb0f automoc: fix line length
Alex
2011-12-06 18:54:30 +01:00
Alex Neundorf 62e223e8fa automoc: add variable CMAKE_AUTOMOC_STRICT_MODE, to enable strict parsing
Alex
2011-12-02 22:08:06 +01:00
Alex Neundorf 40c516783e automoc: accept even more .moc files in non-strict mode
Alex
2011-12-02 21:54:11 +01:00
Alex Neundorf c207f5d361 automoc: also accept other files when .moc is included in non-strict mode
Alex
2011-12-02 21:43:15 +01:00
Alex Neundorf 9c0df72dc4 automoc: add a StrictParseCppFile(), which is only qmake-compatible
ParseCppFile() is the one which is automoc4/KDE4-compatible, and which
becomes a bit crowded. By separating these two it is easier to ensure
that the strict one doesn't get broken accidentially.

Alex
2011-12-02 20:59:44 +01:00
Alex Neundorf 174bf35fbb automoc: move the code for finding headers into separate function
Alex
2011-12-02 20:38:14 +01:00
Alex Neundorf 8507eaed16 automoc: fix handling of included _p.moc files
Alex
2011-11-30 21:43:05 +01:00
Alex Neundorf 7ada172002 automoc: some more linebreaks for the warnings for better readability
Alex
2011-11-29 21:07:50 +01:00
Alex Neundorf 3b93e266c0 automoc: add extra check whether the header contains Q_PRIVATE_SLOT
This is again for KDE4 compatiblity. If foo.moc is included, in general
moc should run on foo.cpp. Usually this can't cause problems.
It can only cause problems if moc must run on the header, and the resulting
file must be included in the cpp file, which is the case with the
Q_PRIVATE_SLOT macro.
This makes the test added by Stephen pass.

Alex
2011-11-29 20:55:36 +01:00
Stephen Kelly a8286235a3 moc is now part of the Qt5Core module
There is no separate SrcTools module anymore.
2011-11-26 15:15:33 +01:00
Alex Neundorf bde4edb6ab automoc: add special handling for including basename_p.moc, with test
Alex
2011-11-22 22:01:13 +01:00
Alex Neundorf 74ab0f6aa4 automoc: move some code from the big parsing loop into separate functions
Alex
2011-11-22 21:35:08 +01:00
Alex Neundorf 72bb058e92 Automoc: modified handling of included .moc files
-enable the KDE4-compatiblity mode only when using Qt4
-always (except in the KDE4 compat mode) error out if a cpp-file
 contains "Q_OBJECT", but does not include filename.moc

Alex
2011-11-16 22:35:06 +01:00
Alex Neundorf e44ebd5f9b automoc: another runtime optimization
before doing the full regexp, try a simple strstr(), if this
already fails, no need to do the regexp matching.

Alex
2011-11-10 22:54:44 +01:00
Alex Neundorf 1423177828 automoc: minor optimization
Handing th std::string instead the char* to the find()
reduces the time from 17 to 15 seconds (for a 1000 times loop of a
relatively small file), which is around 10 percent.

Alex
2011-11-10 22:41:48 +01:00
Alex Neundorf f98e6151dc automoc: improved diagnostics
Error/warning messages now look like:
AUTOMOC: (error|warning): <filename>: the actual text...

Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf 81c43b4fb6 automoc: handle the case when the developer includes the wrong mocfile
There are multiple/many places in KDE where the developer includes
moc_foo.cpp, and expects moc to run on foo.cpp, instead of foo.h.
He should use foo.moc, but right now this is handled by automoc4,
so we must stay compatible. So support this too, but warn about
it.

Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf 7242822897 automoc: rework the checking for the matching header, to give better warnings
Alex
2011-11-10 22:12:03 +01:00
Alex Neundorf d08bc32bc2 automoc: stricter checking for what file is included
foo.cpp must include foo.moc to have itself processed by moc

Alex
2011-11-10 22:11:32 +01:00
Stephen Kelly b8c8cab242 Merge remote-tracking branch 'origin/master' into automoc_qt5 2011-11-10 15:46:13 +01:00
Stephen Kelly bafe5cc6e9 Fix style. 2011-11-10 00:57:21 +01:00
Stephen Kelly 74b9392eb9 Update comments and method names to not be Qt4 specific. 2011-11-09 23:26:09 +01:00
Stephen Kelly 812dab067e Don't assume the existence of QT_MAJOR_VERSION.
Also handle Qt5SrcTools_MAJOR_VERSION.
2011-11-09 23:20:20 +01:00
David Cole a5579b76f0 Merge topic 'FixAutomocFromCCMakeFromPATH'
83d02ee make automoc work when using ccmake via PATH (#12551)
2011-11-08 14:43:38 -05:00
David Cole 3452dadf89 Merge topic 'AddMocOptionsToAutomoc'
2c648ab add documentation for the AUTOMOC_MOC_OPTIONS property
52719a1 automoc: fix #12541, support moc options
2011-11-08 14:42:51 -05:00
David Cole 6c2f30822b Merge topic 'DontCrashAutomocWithEmptyCompileDefs'
1ecc55a Automoc: fix the fix, need to use std::string, not just char* pointer
8c8305f don't crash in automoc with empty COMPILE_DEFINITIONS property
2011-11-08 14:42:46 -05:00
Alex Neundorf 83d02ee52b make automoc work when using ccmake via PATH (#12551)
In ccmake, cmake::GetCMakeCommand() returns "/cmake" when ccmake
was started from the PATH, i.e. by simply running "ccmake"

Alex
2011-11-03 22:55:42 +01:00
Stephen Kelly c208ab8d5c Also run moc automatically with Qt5.
The method of running moc hasn't changed in Qt5.
2011-11-01 14:48:45 +01:00
Alex Neundorf 52719a1d66 automoc: fix #12541, support moc options
This commit adds a new target property AUTOMOC_MOC_OPTIONS, which
can be set to add extra options for the moc invocations done via automoc.
This is equivalent to the OPTIONS parameter in the qt4_wrap_cpp() macro.

Alex
2011-11-01 14:33:11 +01:00
Alex Neundorf 1ecc55aa7b Automoc: fix the fix, need to use std::string, not just char* pointer
We need to take a copy of the property values, since the returned
char* pointer is reused by the following GetProperty() calls

Alex
2011-11-01 13:59:14 +01:00
Alex Neundorf 8c8305f286 don't crash in automoc with empty COMPILE_DEFINITIONS property
Reported by Laszlo Papp:
http://www.cmake.org/pipermail/cmake/2011-October/047089.html

Alex
2011-10-31 22:07:12 +01:00
Alex Neundorf 5e8e9ad68c automoc: always run moc on the cpp file if there is a foo.moc included
This makes automoc behaves as the documentation says.
If there is a #include "foo.moc" in the source file, moc
will be executed on foo.cpp.
Before it was also executed on foo.cpp, but only if foo.cpp
contained a Q_OBJECT macro, otherwise moc was executed on
foo.h. This was confusing, and this change also shouldn't break
anything, since the headers are moc'ed anyway if they contain
a Q_OBJECT macro.

Alex
2011-10-22 21:16:39 +02:00
Alex Neundorf ea8ac9f5dc Add copyright notices
Alex
2011-10-22 19:43:34 +02:00