[CMake] automoc

Lode Leroy lode.leroy at gmail.com
Tue Jun 10 10:07:51 EDT 2014


I was trying to get automoc to work with my Qt4.8 project in cmake-2.812,
and found out that the .h and the .cpp need to be in the same directory.

so this works:
       source/main.cpp
       source/MyWidget.cpp
       source/MyWidget.h

where MyWidget.h contains

class MyWidget : public QWidget {
       Q_OBJECT
public:
       MyWidget();
      ~MyWidget();
};

that is nicely
       Generating moc_MyWidget.cpp



But my project is actually organized as follows:
       source/main.cpp
       source/MyWidget.cpp
       include/MyWidget.h

and the automoc no longer works, since seems like it only scans the same
absolute path in
       Source / cmQtAutoGenerators.cxx :: findMatchingHeader()

is this by design? or am I missing some variable to make it also search in
my "include" directory.

I tried setting *CMAKE_AUTOMOC_MOC_OPTIONS* to
"-I${CMAKE_CURRENT_SOURCE_DIR}/../include" but that didn't help....

-- lode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140610/1da80469/attachment.html>


More information about the CMake mailing list