[cmake-developers] Current deficiencies of automoc

Nagger nagger at gmx.de
Fri Oct 21 19:01:03 EDT 2016


Am 21.10.2016 um 13:39 schrieb Alan W. Irwin:
> On 2016-10-21 09:42+0200 Sebastian Holtermann wrote:
>> headers-to-moc to the sources list.
>> - add_executable(helloworld main.cpp)
>> + add_executable(helloworld main.cpp
>> +    ${CMAKE_SOURCE_DIR}/include/test_q_object.h)
>>
>> The #include "moc_test_q_object.cpp" in main.cpp can be removed then.
>
> 1. The automoc documentation at
> <https://cmake.org/cmake/help/v3.6/prop_tgt/AUTOMOC.html> only
> documents the #include method (which doesn't work for the current test
> case nor for PLplot), and the above working fullpath method is not
> documented at all there.

At least in cmake-qt(7) [1] this is documented:

If a |Q_OBJECT| or |Q_GADGET| macro is found in a header file, |moc| 
will be run on the file. The result will be put into a file named 
according to |moc_<basename>.cpp|. If the macro is found in a C++ 
implementation file, the moc output will be put into a file named 
according to |<basename>.moc|, following the Qt conventions. The |moc 
file| may be included by the user in the C++ implementation file with a 
preprocessor |#include|. If it is not so included, it will be added to a 
separate file which is compiled into the target.


Marc


[1] https://cmake.org/cmake/help/v3.6/manual/cmake-qt.7.html#automoc


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20161022/65e96a13/attachment.html>


More information about the cmake-developers mailing list