qmake: How to set a variable that must contain spaces?
-
wrote on 15 Dec 2017, 15:21 last edited by
I need to set QMAKE_CXXFLAGS to a value that contains spaces, specifically
QMAKE_CXXFLAGS += /AI"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0"
The PROGRAMFILES environment variable will (usually) resolve to a path with spaces. How can I handle that?
-
-
wrote on 15 Dec 2017, 16:05 last edited by
@SGaist
Forgot to mention I'm still sitting on 4.8... -
In that case, did you try with just quote ?
-
@SGaist
Forgot to mention I'm still sitting on 4.8...Without the possibility to test, I think you have to escape the quotes with enough escape chars ('') so the quotes actually get to the shell. You may need two or three pairs of '' to get it work - just test until it works :)
QMAKE_CXXFLAGS += /AI"\\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\\""
Edit: seems my escape chars were lost, I meant backslashes
'\'
-
Without the possibility to test, I think you have to escape the quotes with enough escape chars ('') so the quotes actually get to the shell. You may need two or three pairs of '' to get it work - just test until it works :)
QMAKE_CXXFLAGS += /AI"\\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\\""
Edit: seems my escape chars were lost, I meant backslashes
'\'
wrote on 18 Dec 2017, 08:03 last edited by@aha_1980
That put me on the right track. The solution is:QMAKE_CXXFLAGS += /AI\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\"
Thanks!
-
@aha_1980
That put me on the right track. The solution is:QMAKE_CXXFLAGS += /AI\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\"
Thanks!
@Asperamanca Cool! Thanks for reporting back.
Please mark this thread as solved now.
6/7