One of the first rules to remember when building with SCons is that the source code to be built must be in the same directory/sub-directory as the root level SConstruct script. There are a few options you could consider:
Place the SConstruct at the root directory of A and B, which would control the building of both sub-directories.
Make each directory (A and B) be separate projects and each would have its own SConstruct. Then project B would refer to libraries built separately in project A.
The choice just depends on the nature of the projects and your requirements. A downside to option 2 is that if a source file in A1 or A2 changes, it wont be detected when compiling project B, since project B will only know about the libraries/headers in project A.
Regarding the CPPPATH
construction variable: this variable configures the location of the header files. If this project were on Linux (or other Unix variants) with the gcc/g++ compiler, then the CPPPATH
variable configures the '-I' compiler flags. Remember, when setting the CPPPATH variable, its not necessary to include the '-I' flag, SCons will add it in a platform-independently manner (meaning it will set it based on the platform and compiler being used).