I'm new to C++ and Qt and want to know about the macros which can be used by QMake. in QMake DEFINES += xy_macro
adds xy_macro
to the *.pro
file. Is it possible to define my own macro and where should I save it to use it later by QMake? The issue is that I want to define the SOURCES which must be included in the Makefile. The list of the source file must be then automatically passed to the *.pro file.
Asked
Active
Viewed 51 times
0

Digger
- 23
- 3
-
2Why? This is classic example of question suffering from [XY problem](https://xyproblem.info/). First you should explain why do you need this, since most probably there is better solution for that. And yes it is possible, but you left out to many details to explain how. – Marek R Oct 15 '21 at 10:31
-
I want to add subdir paths to my *.pro file automatically when creating the *.pro file by qmake. Maybe it's not the best way, but I think it would be possible to do this by defining a macro to qmake. But I don't know in which format and where a defined macro must be saved to be addressed later by "DEFINES" in qmake: – Digger Oct 15 '21 at 10:51
-
when you are explaining your issue please [edit] your question instead commenting, so other users do not have to walk through comments to have full picture. – Marek R Oct 15 '21 at 10:53
-
At topic it is not fully clear form me what is your aim, but looks like after your comment it becomes completely unrelated to C macros. Does this solves your problem [Built-in Functions and Control Flow](https://doc.qt.io/qt-5/qmake-project-files.html#built-in-functions-and-control-flow) - note `include`? – Marek R Oct 15 '21 at 10:57
-
No, actually I want to automatically add the list of the files to the *.pro file when I execute qmake. I've edited the question to make it more specific about the issue. – Digger Oct 15 '21 at 11:47
-
Possible duplicate: https://stackoverflow.com/a/41121739/1387438 (can mark it as duplicate after question was edited , because of my earlier close vote). – Marek R Oct 15 '21 at 11:51
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 16 '21 at 14:48