15.6. Using Glob with VariantDir

The Glob file name pattern matching function works just as usual when using VariantDir. For example, if the src/SConscript looks like this:

env = Environment()
env.Program('hello', Glob('*.c'))
      

Then with the same SConstruct file as in the previous section, and source files f1.c and f2.c in src, we would see the following output:

% ls src
SConscript  f1.c  f2.c  f2.h
% scons -Q
cc -o build/f1.o -c build/f1.c
cc -o build/f2.o -c build/f2.c
cc -o build/hello build/f1.o build/f2.o
% ls build
SConscript  f1.c  f1.o  f2.c  f2.h  f2.o  hello

The Glob function returns Nodes in the build/ tree, as you'd expect.