[Scons-users] expanding $_CPPINCFLAGS with quoting of directory names containing spaces

Karl Ostmo kostmo at gmail.com
Mon Aug 11 19:54:29 EDT 2014


Hi Jason,

Thanks, that solution worked.

I am still curious how I could make env.subst("$_CPPINCFLAGS") behave the
same as it does in the context of a Builder action with regard to quoting (
think it must have something to do with CmdStringHolder and the
quote_spaces function), but I guess that is moot now.

Karl


On Mon, Aug 11, 2014 at 8:41 AM, Kenny, Jason L <jason.l.kenny at intel.com>
wrote:

>  I believe all you need to do is this:
>
>
>
> env[‘CXXCOM’ ]  = '${TEMPFILE("$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS
> $_CCCOMCOM $SOURCES $CCARCHFLAGS")}'
>
>
>
> Jason
>
>
>
> *From:* Scons-users [mailto:scons-users-bounces at scons.org] *On Behalf Of *Karl
> Ostmo
> *Sent:* Friday, August 8, 2014 5:59 PM
> *To:* SCons users mailing list
> *Subject:* [Scons-users] expanding $_CPPINCFLAGS with quoting of
> directory names containing spaces
>
>
>
> We are working around an issue of the command-line invocation of the
> compiler being too long for Windows.
>
>
>
> The compiler provides a mechanism to offload command-line arguments to a
> file.  The path to the arguments file is supplied to the compiler with a @
> symbol prefixed.
>
>
>
> As an example, this command:
>
> gcc my_source_file.c -o my_compiled_binary.o -Isome_include_dir
> -Ianother_include_dir
>
>
>
> Could be rewritten as this:
>
> gcc my_source_file.c -o my_compiled_binary.o @my_arguments.args
>
>
>
> Where "my_arguments.args" contains this:
>
>  -Isome_include_dir -Ianother_include_dir
>
>
>
>
>
> I've written a Builder that writes the content of the $_CPPINCFLAGS
> variable to a file, then supplies that file to the compiler.  To obtain the
> interpolated value of $_CPPINCFLAGS, I used env.subst("$_CPPINCFLAGS").
>
> The problem arises when one of the directory names in the CPPPATH contains
> spaces.  Before the conversion of this Builder to make use of
> a @my_arguments.args file, the CPPPATH entries that contained spaces were
> properly quoted on the command line.
>
> For example, with CPPPATH entries named "some include dir" and
> "another_include_dir", the final shell command appeared as:
>
>
>
> gcc my_source_file.c -o my_compiled_binary.o -I"some include dir"
> -Ianother_include_dir
>
>
>
> However, when expanded via the env.subst() function, the quotes are not
> inserted.  Instead, I see this as the output to env.subst("$_CPPINCFLAGS"):
>
>  -Isome include dir -Ianother_include_dir
>
>
>
>
>
> In this case, the words "include" and "dir" are interpreted by the
> compiler as independent command-line arguments, resulting in an error.  How
> can I expand the value of $_CPPINCFLAGS in a way that preserves the
> space-quoting behavior?
>
>
>
> Thanks,
>
> Karl
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140811/b40ae261/attachment-0001.html>


More information about the Scons-users mailing list