Search code examples
scons

Scons compiler path contains spaces


I have a toolchain, not on the path, installed at a location containing spaces (C:\Program Files\Some Compiler\). I've tried:

env = Environment(
    MY_TOOLCHAIN_ROOT = R'C:\Program Files\Some Compiler\',
    MY_TOOLCHAIN_BIN = R'$MY_TOOLCHAIN_ROOT\bin',
)
env.Replace(
    CC = "$MY_TOOLCHAIN_BIN/gcc",
    CXX = "$MY_TOOLCHAIN_BIN/g++",
    OBJCOPY = "$MY_TOOLCHAIN_BIN/objcopy"
)

env.Program('main.cpp')

But I get the error

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

How can I get scons to quote the spaces?


Solution

  • Seems I need to mark them as Files:

    env.Replace(
        CC = env.File("$MY_TOOLCHAIN_BIN/gcc"),
        CXX = env.File("$MY_TOOLCHAIN_BIN/g++"),
        OBJCOPY = env.File("$MY_TOOLCHAIN_BIN/objcopy")
    )