qmake escapes spaces within environment variables
-
wrote on 20 Oct 2020, 06:03 last edited by Tom asso
I have a linux environment variable defined as:
export GMT_LIBS='-L/bogusDir -lgmt'
I want to access MYLIBS from within my .pro file and add it to the LIBS variable:
gmtLibs = $$getenv("GMT_LIBS") LIBS += $gmtLibs
But when qmake is generating a Makefile, it escapes the space within GMT_LIBS with back-slash, so the Makefile contains:
LIBS = $(SUBLIBS) -L/bogusDir\ -lgmt
When ‘make’ processes this Makefile, it does not link with library -lgmt, so results in “undefined reference” errors. If I manually edit the Makefile and remove the ‘\’ preceding -lgmt, then rerun ‘make’, it links properly.
I get the same escaped space in the Makefile if the .pro file accesses environment variable with this instead of getenv():
LIBS += $$(GMT_LIBS)
So how do I convince qmake not to escape spaces within environment variables?
Thanks!
-
Since these are two parameters but you treat it as one I would go with split()
-
Since these are two parameters but you treat it as one I would go with split()
wrote on 20 Oct 2020, 06:24 last edited by
1/3