Here's my simple case. I got a source file structure as following:
.
├── SConstruct
└── src
├── SConscript
├── staticLib
│ ├── classInStaticLib.cpp
│ ├── classInStaticLib.h
│ └── SConscript
└── test.cpp
SConstruct:
VariantDir('build', 'src', duplicate=0)
SConscript('build/SConscript')
src/SConscript:
import os
lib = 'staticLib'
SConscript(os.path.join(lib, 'SConscript'))
Program( 'test',
'test.cpp',
CPPPATH = lib,
LIBS = lib,
LIBPATH = lib )
src/staticLib/SConscript:
Library('staticLib', 'classInStaticLib.cpp')
After I run scons, I got following in shell:
g++ -o build/staticLib/classInStaticLib.o -c src/staticLib/classInStaticLib.cpp
ar rc build/staticLib/libstaticLib.a build/staticLib/classInStaticLib.o
ranlib build/staticLib/libstaticLib.a
g++ -o build/test.o -c -Ibuild/staticLib -Isrc/staticLib src/test.cpp
g++ -o build/test build/test.o -Lbuild/staticLib -Lsrc/staticLib -lstaticLib
scons completed with no error. But please attention that there're both "-Ibuild/staticLib" and "-Isrc/staticLib" in 4th line, and both "-Lbuild/staticLib" and "-Lsrc/staticLib" in 5th line. There should be only one.
Why this happens ?