blob: c0389b9256f6624bc99c1d6864b29d8e99ffd6b9 [file] [log] [blame]
SCons gotchas
=============
Avoiding getting object files in the source tree
------------------------------------------------
If you use an absolute pathname in a source file list, SCons has the
annoying default behaviour of putting the resulting .o object file into the
source tree instead of into the build directory (under "scons-out").
For example, the following will do that:
# bad
env.ComponentLibrary('gtest',
['${SOURCE_ROOT}/testing/gtest/src/gtest-all.cc'])
The workaround, which we use in various places, is to use ComponentObject()
to override the .o filename. For example:
# good
env.ComponentLibrary(
'gtest',
[env.ComponentObject('gtest-all.o',
'${SOURCE_ROOT}/testing/gtest/src/gtest-all.cc')])
This fixed version avoids the problem of gtest-all.c getting rebuilt when
switching between the x86-32 and x86-64 builds.