How to run MOC on files which are not part of a project?
-
I there a way to let the Meta-Object Compiler run on header-files which are not explicitly added to project but only included?
The docu states https://doc.qt.io/qt-6/moc.html:
"The moc tool reads a C++ header file. If it finds one or more class declarations that contain the Q_OBJECT macro, it produces a C++ source file containing the meta-object code for those classes",
If this statement is correct, then the moc tool doesn't read the header files which are not explicitly added to project. It there a way to force him, to do so?
One coding lot header-only will face the problem sooner or later.
Thank you in advance. -
I there a way to let the Meta-Object Compiler run on header-files which are not explicitly added to project but only included?
The docu states https://doc.qt.io/qt-6/moc.html:
"The moc tool reads a C++ header file. If it finds one or more class declarations that contain the Q_OBJECT macro, it produces a C++ source file containing the meta-object code for those classes",
If this statement is correct, then the moc tool doesn't read the header files which are not explicitly added to project. It there a way to force him, to do so?
One coding lot header-only will face the problem sooner or later.
Thank you in advance.@Greg_Phil said in How to run MOC on files which are not part of a project?:
If this statement is correct, then the moc tool doesn't read the header files which are not explicitly added to project. It there a way to force him, to do so?
One coding lot header-only will face the problem sooner or later.No you won't - as soon as you have to moc a header for a library the library is no longer header-only.
apart from this see qt_wrap_cpp -
@Greg_Phil said in How to run MOC on files which are not part of a project?:
If this statement is correct, then the moc tool doesn't read the header files which are not explicitly added to project. It there a way to force him, to do so?
One coding lot header-only will face the problem sooner or later.No you won't - as soon as you have to moc a header for a library the library is no longer header-only.
apart from this see qt_wrap_cpp@Christian-Ehrlicher Thank you for the hint. I will try AUTOMOC, I'm using Cmake anyway.