Page 1 of 1

Use Qt5 mocing without qmake

Posted: Mon Dec 19, 2016 9:41 am
by cody
I'm using the Codelite IDE under ArchLinux and the gcc compiler.
Is there a way to moc the qt-specific headers automatically via project settings or do I have to moc all files manually as pre-build command?

I couldn't find any option in Codelite for selecting single header files in project tree for moc'ing them.
Also it seems not to be possible to adjust build settings for only single files - there are only the overall project settings.
Or am I missing something?

Re: Use Qt5 mocing without qmake

Posted: Mon Dec 19, 2016 9:56 am
by eranif
cody wrote:Is there a way to moc the qt-specific headers automatically via project settings or do I have to moc all files manually as pre-build command?
If you are using the default build system of CodeLite, then you need to this for each file. CodeLite does not inspect the header files searching for the Q_OBJECT macro.
You could use the 'CMake' build system of CodeLite and in the user section of the generated 'CMakeLists.txt' you can add this line:

Code: Select all

set(CMAKE_AUTOMOC ON)
which is explained here: https://cmake.org/cmake/help/v3.0/manua ... ml#automoc

Details of the 'CMake' plugin of CodeLite:
http://codelite.org/LiteEditor/TheCMakePlugin

Re: Use Qt5 mocing without qmake

Posted: Mon Dec 19, 2016 1:22 pm
by cody
Thanks for the fast response. I will try as you suggested using Cmake