I added a new #DEFINE
to my ".pro" file like this:
#DEFINE += SVN_V
now I would like to pass the output of the command "svnversion -n" to this SVN_V
, and here is what I did:
#DEFINE += "SVN_V = svnversion -n"
but the result is
error: no such file or directory
error: svnversion: no such file or directory
so, what am I missing here exactly? (Be aware I am working with Linux Ubuntu)
It could be something like that:
DEFINES += "SVN_V=\"\\\"$$system(svnversion -n)\\\"\""
$$system()
is a qmake function to execute system command and obtain output from it.
external quotes around SVN_V... - is for qmake - it must understand that this is a single define. If $$system()
returns space delimited string "Unknown version" you will get in result: -DSVN="Unknown -Dversion"
.
Next quotes \"
- to pass $$system()
result to compiler. Without it you will get two arguments instead of one "Unknown
and version"
.
Double quoted quotes \\\"
is to pass value to preprocessor. Without it value will be without quotes and recognized as int. \\\"
will be resolved by qmake as \"
and passed to compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With