Wireshark mailing list archives

Re: moc file generation using cmake auto macros


From: Peter Wu <peter () lekensteyn nl>
Date: Thu, 20 Apr 2017 18:57:44 +0200

Hi Paul,

On Thu, Apr 20, 2017 at 03:39:43PM +0000, Paul Offord wrote:
Hi,

I'm working through a long list of feedback points relating to a code submission I made - 
https://code.wireshark.org/review/#/c/19666/

Roland has rightly flagged that I need to generate the moc files with
each cmake run.  I've never known how to do this - I currently use a
.bat file to run a bunch of moc.exe commands.  I'm keen to learn how
to do it.  These are his comments:

"moc_ files should be added using Qt5 macros, not by the file itself.
They must be generated on every run of cmake using the auto macros,
respectively on every run of make using the moc compiler.  They MUST
NOT be included in the repository, as they change depending on the Qt
version, the plugin is built with."

Assume I know next to nothing about cmake (coz that's the truth).  Can
you tell me how to do what Roland suggests or point me to an example
cmake file I can use as a template?

I think that you should have a look at ui/qt/CMakeLists.txt, especially
WIRESHARK_QT_HEADERS (which contains the Q_OBJECT macros) and
QT5_WRAP_CPP.

Looking around, I also found: https://doc.qt.io/qt-5/cmake-manual.html
Perhaps we could do this better as there is also:
https://cmake.org/cmake/help/v3.0/prop_tgt/AUTOMOC.html
https://cmake.org/cmake/help/v3.0/manual/cmake-qt.7.html
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: