Adding #define to main .pro
-
I like to add single place to control preprocessor entries AKA #define for example.
I can add "common #define" to subdir project subproject .pro
DEFINES += "TEST_FLOW_CHART"
works as expected
Adding same to main .pro file does not work.
Is there any other way / place to have / add common directives ?I believe GCC has some "additional processing" options, but I forgot how to do that . But doing this in main .pro would be proffered.
-
@AnneRanch said in Adding #define to main .pro:
Is there any other way / place to have / add common directives ?
Yes, you can, for example, create a
common.pri
file like:DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
Then include that
*.pri
from all of your*.pro
files, like:include(../common.pri)
Of course, adjust the path to
common.pri
accordingly.Here's a real-world (albeit pretty old) example from one of my open source projects:
- ./common.pri
- ./src/src.pro - includes
common.pri
- ./test/test.pro - also includes
common.pri
Cheers.
-
@AnneRanch said in Adding #define to main .pro:
Is there any other way / place to have / add common directives ?
Yes, you can, for example, create a
common.pri
file like:DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
Then include that
*.pri
from all of your*.pro
files, like:include(../common.pri)
Of course, adjust the path to
common.pri
accordingly.Here's a real-world (albeit pretty old) example from one of my open source projects:
- ./common.pri
- ./src/src.pro - includes
common.pri
- ./test/test.pro - also includes
common.pri
Cheers.
@Paul-Colby Thanks for the reply. Just for sake of discussion - what would be the benefit of adding EXTRA file to EACH suboproject ?
Besides it does not meet the post " specification" to " add single place to control preprocessor" to main .pro.
Cheers