How to automate Qt moc?

旧街凉风 提交于 2019-12-05 15:26:36

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:

  1. Run qmake -project when you start working on a project.
  2. Run qmake when you want to generate Makefiles.
  3. Run make when you want to build the project.

I guess you have two choices.

  1. call qmake from a parent make process and do a multilevel build. ("Recursive make".)

  2. directly run the meta-object compiler from rules in your makefile

If the second, this page on using the meta-object compiler may help.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!