i have to run the following commands from Qt command prompt: 'qmake -project' then 'make' and this gives me the debug folder with the Moc file. this is strangely the only way my PC will generate the moc_.cpp file. So how can i automate the task of these commands so i dont have to use these commands again?
A:
I guess you have two choices.
call qmake from a parent make process and do a multilevel build. ("Recursive make".)
directly run the meta-object compiler from rules in your makefile
If the second, this page on using the meta-object compiler may help.
DigitalRoss
2009-10-13 00:57:06
+2
A:
You should not run qmake -project
multiple times. The -project
option is meant to provide you a template project file for you to edit. An equivalent of what you are doing in an IDE would be creating a "New Project" every time you want to build. After you have the initial project, you should edit it manually, add files when you have new files, etc. If some header file changes, the generated Makefile will notice it and call moc on it to update the moc_*.cpp file automatically. So:
- Run
qmake -project
when you start working on a project. - Run
qmake
when you want to generate Makefiles. - Run
make
when you want to build the project.
Lukáš Lalinský
2009-10-14 09:40:33