The output file tells automoc4 how the source file that contains the #include lines of the moc files that are not included in any other source files of the target is called. It also uses this file name and appends .files to find the other variables set by the cmake macro. (i.e. it reads <current source dir>/<output file>.files and creates <current binary dir>/<output file>)

The output file tells automoc4 how the source file that contains the #include lines of the moc files that are not included in any other source files of the target is called. It also uses this file name and appends .files to find the other variables set by the cmake macro. (i.e. it reads <current source dir>/<output file>.files and creates <current binary dir>/<output file>)

+

+

The moc executable is the full filepath to the executable, so that automoc4 can reuse this information.

+

+

The cmake executable is also the full filepath and is used for colored status output.

+

+

The --touch switch tells automoc4 to update the timestamp of <current source dir>/<output file>.files after it touched <current binary dir>/<output file>. This ensures that automoc4 always gets called for every target. This switch is not needed if automoc4 is used as an extra target, since in that case it will be called unconditionally already.

==Features==

==Features==

Revision as of 14:47, 17 August 2008

Contents

Usage in CMakeLists.txt

You should not use the automoc4 executable directly. Instead use the FIND_PACKAGE()
command to use Automoc4 in your CMakeLists.txt (best use FindAutomoc4.cmake). Then you can add two lines per target to your CMakeLists.txt and you never need to worry about moc files anymore:

The automoc4 macro adds a custom command that outputs a source file that is then added to the sources for the target. (This breaks with nmake as that gets the timestamp of the output file wrong and then recompiles and relinks every time.)

The add_automoc4_target macro adds a new target, which, when called, generates all moc files and a source file to include those when needed and adds the name of that source file to foobar_srcs.

The add_dependencies macro tells cmake to add a dependency such that foobar only gets called after foobar_automoc is done.

When using the KDE4 cmake macros then don't worry about all this. Instead just use the kde4_add_{executable,library,plugin} macros.

Command Line Usage

The output file tells automoc4 how the source file that contains the #include lines of the moc files that are not included in any other source files of the target is called. It also uses this file name and appends .files to find the other variables set by the cmake macro. (i.e. it reads <current source dir>/<output file>.files and creates <current binary dir>/<output file>)

The moc executable is the full filepath to the executable, so that automoc4 can reuse this information.

The cmake executable is also the full filepath and is used for colored status output.

The --touch switch tells automoc4 to update the timestamp of <current source dir>/<output file>.files after it touched <current binary dir>/<output file>. This ensures that automoc4 always gets called for every target. This switch is not needed if automoc4 is used as an extra target, since in that case it will be called unconditionally already.