Use Qt5 mocing without qmake

General questions regarding the usage of CodeLite
cody
CodeLite Curious
Posts: 4
Joined: Mon Dec 19, 2016 9:33 am
Genuine User: Yes
IDE Question: c++
Contact:

Use Qt5 mocing without qmake

Post by cody » Mon Dec 19, 2016 9:41 am

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?

User avatar
eranif
CodeLite Plugin
Posts: 6056
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Use Qt5 mocing without qmake

Post by eranif » Mon Dec 19, 2016 9:56 am

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
Make sure you have read the HOW TO POST thread

cody
CodeLite Curious
Posts: 4
Joined: Mon Dec 19, 2016 9:33 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Use Qt5 mocing without qmake

Post by cody » Mon Dec 19, 2016 1:22 pm

Thanks for the fast response. I will try as you suggested using Cmake

Post Reply