Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define a string in qmake command line

Tags:

g++

qmake

I need to pass a string as a definition to my source code which is a base64 encoded string (so may contain / and "). I'm using qmake and g++. I've tried so many combinations, but neither works:

qmake DEFINES+=SERIAL=\\\"f9a/z\\\"
qmake DEFINES+=SERIAL=\"f9a/z\"
qmake DEFINES+="SERIAL=\\"f9a/z\\\""

G++ should get the serial like this:

g++ -DSERIAL=\"f9a/z\"
like image 853
sorush-r Avatar asked Nov 02 '22 06:11

sorush-r


1 Answers

In bash:

qmake DEFINES+=SERIAL=\\\\\\\"\"f9a/z\\\\\\\"\"

In a scripting language:

"DEFINES+=SERIAL=\\\\\\\"" + str + "\\\\\\\""
like image 161
andrewrk Avatar answered Jan 04 '23 14:01

andrewrk