Transitive dependencies for static libraries and SCons

I came across a seemingly simple problem, creating two libraries and test programs for both.

Problem: I have two static libraries, libA and libB, and libB is dependent on libA. I don’t want to explicitly link all programs that use libB to libA, I want SCons to see that if the program is linked to library B, it must also link to library A.

I built a simple example illustrating this problem. Since I could not find a suitable file host, and this is due to programming, I created a small SVN repository:

svn checkout https://example-repository.googlecode.com/svn/trunk example-repository

or you can download tarball here .

+5
source share
2 answers

SCons does not have built-in support for expressing transitive library dependencies, as you describe, but its younger cousin is Waf . See the documentation for the "use" function in the Waf book. Boost build system also has this function under a different name , you can also implement it yourself in SCons, if you want to encode a bit of Python.

, , - (.. , Python). , , - , (.. , SConscripts), .

+4

libB libA? libs, .o .o?

libs - .o, libB.o, libA.o, libB.o libA.o. libB.o, libA, libB.o .

, :

cc -o a.out a.c libA.a libB.a

libB libA.

0

All Articles