So far, I’ve only seen examples of running SCons in the same folder as the single SConstruct file resides. Let’s say my project structure is like:
- src/*.(cpp|h)
- tools/mytool/*.(cpp|h)
What I’d like is to be able to run ‘scons’ at the root and also inside tools/mytool. The latter compiles only mytool. Is this possible with SCons?
I assume it involves creating another SConstruct file. I’ve made another one: tools/mytool/SConstruct
I made it contain only:
SConscript('../../SConstruct')
and I was thinking of doing Import(‘env mytoolTarget’) and calling Default(mytoolTarget), but running it with just the above runs in the current directory instead of from the root, so the include paths are broken.
What’s the correct way to do this?
You can use the
-uoption to do this. From any subdirectory,scons -uwill search upwards in the directory tree for anSConstructfile.