Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 792631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:01:22+00:00 2026-05-14T22:01:22+00:00

I recently began setting up my own library and projects using a cross platform

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:01:23+00:00Added an answer on May 14, 2026 at 10:01 pm

    The typical way that this is handled is by having the library on which you depend tell you what it, in turn, requires and what versions it has linked against. One way of doing this is via pkg-config. For example, if you invoke pkg-config name_of_package –cflags, it will print out the necessary flags that should include flags needed to add headers of indirect dependencies. Similarly, pkg-config name_of_package –ldflags would print the necessary linker flags that include that particular library as well as its dependencies. As for build system, my recommendation would be to use CMake. In CMake, dependencies are found via an invocation of FIND_PACKAGE(name_of_package), which in turn defines the variable name_of_package_FOUND as 1 if the package was found, and also — if it was found — defines name_of_package_LIBRARIES and name_of_package_INCLUDE_DIRS to the libraries and header paths for that package as well as to the libraries and headers of its dependencies. That said, the FIND_PACKAGE mechanism works via pluggable modules written by third parties, and so while the system is supposed to set the _LIBRARIES and _INCLUDE_DIRS variables such that dependencies of dependencies are included recursively, not all of the modules do this correctly last I checked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.