When the compilation_db scons emitter saved compilation database
entried it always used the "global" environment which might not match
the compilation command line actually used to build the target.
That meant that using eg.:
env.Library("foo", ["foo.cpp"], CXXFLAGS=["-Dfoo"])
Would not write the extra "-Dfoo" flag actually used to build the foo
library to the compile_commands.json file.
Instead save the environment used to generate the target and use that
when writing the compile_command.json entry.