When I call a builder Program(Target, Source, CXXFLAGS=CompileFlags) the value of CompileFlags string contains -Wl,-rpath,lib:$ORIGIN/../lib causing $ORIGIN to be expanded to empty string, while it should be preserved as is.
I tried escaping the dollar sign, adding single quotes inside, nothing helps.
env['RPATH'] = Literal('lib:$ORIGIN/../lib')
also does not work: it produces
g++ -o main -Wl,-rpath=lib:/../lib
in command line even though the man page says “the paths added to RPATH are not transformed by scons in any way” so it supposed to work even without Literal(), I guess.
So how can I add a compiler flag containing $TEXT without SCons trying to expand it as a variable?
Thanks.
You can use double dollars, like this: