c++ - How to pass a cmd-command output to a #DEFINE MACRO in QMake -
i added new #define ".pro" file this:
#define += svn_v now pass output of command "svnversion -n" svn_v, , here did:
#define += "svn_v = svnversion -n" but result
error: no such file or directory
error: svnversion: no such file or directory
so, missing here exactly? (be aware working linux ubuntu)
it that:
defines += "svn_v=\"\\\"$$system(svnversion -n)\\\"\"" $$system() qmake function execute system command , obtain output it.
external quotes around svn_v... - qmake - must understand single define. if $$system() returns space delimited string "unknown version" in result: -dsvn="unknown -dversion".
next quotes \" - pass $$system() result compiler. without 2 arguments instead of 1 "unknown , version".
double quoted quotes \\\" pass value preprocessor. without value without quotes , recognized int. \\\" resolved qmake \" , passed compiler.
Comments
Post a Comment