Commit Graph

25 Commits

Author SHA1 Message Date
Stephen Kelly ea4d7848e5 QtAutomoc: Use config-dependent compile definitions and includes.
Instead of always using the includes and defines which are not
config-specific, ensure that the config specific ones can be used.

Task-number: #13589
2013-06-12 12:53:25 +02:00
Stephen Kelly a223a3b65f Automoc: Don't create automoc targets if Qt is not used (#13999)
Commit 79568f95 (automoc: Add source file to target early to set the
linker language, 2013-02-20) changed automoc initialization to a two
step process. In the first step, the generated source file was added
to the target, which allows the link language to be determined.

However, this bypassed the check for the availability of Qt itself.
At build-time the automoc file could not be generated because the moc
tool was not available to create it.

The solution is to only add the automoc file to the target if Qt is
found.
2013-03-12 17:42:02 -04:00
Stephen Kelly 79568f95ab automoc: Add source file to target early to set the linker language
Previously, GetIncludeDirectories was called before calling
target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the
link information as a source of compile definitions and
includes., 2013-02-12), the include directories are determined by
the link information.

Valid link information requires that the linker language can be
determined, which depends on the source files languages and the
dependent targets languages. In the case of the no_link_languages
target in the unit test, there are no dependencies and the additional
source file no_link_languages_automoc.cpp is added to the target
at generate-time. That file can be used to determine the linker
language, but it must be added to the target before calling
GetIncludeDirectories.
2013-02-22 08:29:33 -05:00
Alex Neundorf 27e14a813c automoc: use the header extensions from cmMakefile
Instead of having an own set of C header extensions, use
cmMakefile::GetHeaderExtensions() (#13904)

Alex
2013-02-10 18:10:20 +01:00
Alex Neundorf 10511aa084 automoc: use a std::vector<> instead a std::list
Alex
2013-02-10 17:49:42 +01: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 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 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 62e223e8fa automoc: add variable CMAKE_AUTOMOC_STRICT_MODE, to enable strict parsing
Alex
2011-12-02 22:08:06 +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
David Cole 1e055d374e Merge topic 'automoc_qt5'
bafe5cc Fix style.
74b9392 Update comments and method names to not be Qt4 specific.
812dab0 Don't assume the existence of QT_MAJOR_VERSION.
2011-11-15 14:39:00 -05:00
Stephen Kelly 74b9392eb9 Update comments and method names to not be Qt4 specific. 2011-11-09 23:26:09 +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 ea8ac9f5dc Add copyright notices
Alex
2011-10-22 19:43:34 +02:00
Alex Neundorf 56aa6ffae7 automoc:run moc on the header if the source file contains include "foo.moc"
This fixes #12533.
Before automoc did not check the header if the source file contained a
statement, now it does.
Additionally, moc is now only run on explicitely listed headers which
contain a Q_OBJECT macro.

Alex
2011-10-22 19:38:39 +02:00
Alex Neundorf c27607baf8 Refactor SetupAutomocTarget() so it can be run after creating the target
This makes it easier to move it from InitialPass() to some other
location, e.g. FinalPass() or something else.

Alex
2011-08-16 01:27:30 +02:00
Alex Neundorf ddb517d014 Color output when running moc
Alex
2011-08-14 16:43:04 +02:00
Alex Neundorf ace121534d Move code for parsing a cpp-file from the big loop to separate function
Alex
2011-08-14 15:58:09 +02:00
Alex Neundorf 126c6ead77 Add the cmake module required currently for automoc
Alex
2011-08-14 15:58:00 +02:00
Alex Neundorf de91feb367 Remove the need to check for .h/.cxx during buildtime
Instead it now relies on cmake time to put that information
correctly into AutomocInfo.cmake

Alex
2011-08-14 15:53:50 +02:00
Alex Neundorf d65689a3bd Add actual automoc code from automoc
It already works :-)
Needs more refactoring, e.g. using the cmake facilities to turn a string
into a vector etc.
Also still missing is the part which creates the custom target.

Alex
2011-08-14 15:53:38 +02:00
Alex Neundorf d1c0a5fce6 Start implementing skeleton for automoc in cmake
Alex
2011-08-14 15:45:13 +02:00
Alex Neundorf a65011baf1 Start work on automoc: add empty cmQtAutomoc class
Alex
2011-08-07 12:02:46 +02:00