Build System with Recursive Dependency Aggregation

Posted by radman on Stack Overflow See other posts from Stack Overflow or by radman
Published on 2010-05-17T03:34:12Z Indexed on 2010/05/17 3:40 UTC
Read the original article Hit count: 458

Filed under:
|
|
|

Hi,

I recently began setting up my own library and projects using a cross platform build system (generates make files, visual studio solutions/projects etc on demand) and I have run into a problem that has likely been solved already.

The issue that I have run into is this: When an application has a dependency that also has dependencies then the application being linked must link the dependency and also all of its sub-dependencies. This proceeds in a recursive fashion e.g.

(For arguments sake lets assume that we are dealing exclusively with static libraries.)

  • TopLevelApp.exe
    • dependency_A
      • dependency_A-1
      • dependency_A-2
    • dependency_B
      • dependency_B-1
      • dependency_B-2

So in this example TopLevelApp will need to link dependency_A, dependency_A-1, dependency_A-2 etc and the same for B. I think the responsibility of remembering all of these manually in the target application is pretty sub optimal. There is also the issue of ensuring the same version of the dependency is used across all targets (assuming that some targets depend on the same things, e.g. boost).

Now linking all of the libraries is required and there is no way of getting around it. What I am looking for is a build system that manages this for you. So all you have to do is specify that you depend on something and the appropriate dependencies of that library will be pulled in automatically.

The build system I have been looking at is premake premake4 which doesn't handle this (as far as I can determine). Does anyone know of a build system that does handle this? and if there isn't then why not?

© Stack Overflow or respective owner

Related posts about c++

Related posts about build-system