Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] .pro-Files without HEADERS
I was asked why we need to include the HEADERS into our .pro files. I should note that we do not use Creator as our primary IDE, we create the .pro-Files in order to use qmake for batch compilation.
Is there any good reason other than the IDE to include the HEADERS? Will omitting them cause dependency problems? Would a .pro-File without HEADERS still open & compile in Creator (for those of us who occasionally use that IDE)?
tilsitt last edited by
According to the "doc":http://doc.qt.digia.com/4.7/qmake-variable-reference.html#headers, the HEADERS variable is used by qmake to generate dependency information and detect if moc is required. So, yes, there are good reasons ;)
But shouldn't adding a DEPENDSPATH to the path where the headers are located do the same thing?
No, this tells qmake to check wether something has changed in these paths and rebuild if necessary
If I understand you correctly, moc might not be run based on a header file change, even if the folder containing the header file is part of the DEPENDS_PATH.
Yes, qmake will take the files from HEADERS and parse them to know if moc needs to be run.
(Note: Seems like a plain "Thanks" does not conform to some posting rule. So I add this rather pointless explanation)
You're welcome !
You might also want to set this thread as solved