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


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to