I have a code-base similar to the following:
sources:
src/a/b/c.cpp
and unit-tests (these are actually boost unit-test executables):
test/a/b/c_test.cpp
The src
tree is used in a single executable target. However c.cpp
only uses a sub-set of the library dependencies of that target, e.g. -lx
, of -lx -ly -lz
.
Similarly, c_test.cpp
compiles to a test executable that links to c.cpp's -lx
,c.o
and a few more additional libraries for testing.
For setting up the build-system, in this case I have two options:
- Pair each such executable in the build-system with its own library dependency list. (Painful, but perhaps could be automated by mapping header dependency -> library.)
- Or, just use the same library list for all test executables and the main executable. (The easy, painless way).
What is the build-system performance impact of #2 "in the large"? Does it really matter?
Misc: This is with g++ (Debian 4.9.1-16) 4.9.1