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 866879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:52:57+00:00 2026-05-15T09:52:57+00:00

Over the years my projects use more and more external libraries, and the way

  • 0

Over the years my projects use more and more external libraries, and the way I did it starts feeling more and more awkward (although, that has to be said, it does work flawlessly). I use VS on Windows, CMake on others, and CodeComposer for targetting Digital Signal Processors (DSPs) on Windows. Except for the DSPs, both 32bit and 64bit platforms are used.

Here’s a sample of what I am doing now; note that as shown, the different external libraries themselves are not always organized in the same way. Some have different lib/include/src folders, others have a single src folder. Some came ready-to-use with static and/or shared libraries, others were built

/path/to/projects
                 /projectA
                 /projectB

/path/to/apis
             /apiA
                  /src
                  /include
                  /lib

             /apiB
                  /include
                  /i386/lib
                  /amd64/lib

/path/to/otherapis
                  /apiC
                      /src

/path/to/sharedlibs
                  /apiA_x86.lib       -->some libs were built in all possible configurations
                  /apiA_x86d.lib
                  /apiA_x64.lib
                  /apiA_x64d.lib
                  /apiA_static_x86.lib
                  /apiB.lib           -->other libs have just one import library

/path/to/dlls                         -->most of this directory also gets distributed to clients
             /apiA_x86.dll               and it's in the PATH
             /apiB.dll

Each time I add an external libary, I roughly use this process:

  • build it, if needed, for different configurations (release/debug/platform)
  • copy it’s static and/or import libraries to ‘sharedlibs’
  • copy it’s shared libraries to ‘dlls’
  • add an environment variable, eg ‘API_A_DIR’ that points to the root for ApiA, like ‘/path/to/apis/apiA’
  • create a VS property sheet and a CMake file to state include path and eventually the library name, like include = ‘$(API_A_DIR)/Include’ and lib = apiA.lib
  • add the propertysheet/cmake file to the project needing the library

It’s especially step 4 and 5 that are bothering me. I am pretty sure I am not the only one facing this problem, and would like see how others deal with this.

I was thinking to get rid of the environment variables per library, and use just one ‘API_INCLUDE_DIR’ and populating it with the include files in an organized way:

/path/to/api/include
                    /apiA
                    /apiB
                    /apiC

This way I do not need the include path in the propertysheets nor the environment variables. For libs that are only used on windows I even don’t need a propertysheet at all as I can use #pragmas to instruct the linker what library to link to.
Also in the code it will be more clear what gets included, and no need for wrappers to include files having the same name but are from different libraries:

#include <apiA/header.h>
#include <apiB/header.h>
#include <apiC_version1/header.h>

The withdrawal is off course that I have to copy include files, and possibly** introduce duplicates on the filesystem, but that looks like a minor price to pay, doesn’t it?

** actually once libraries are built, the only thing I need from them is the include files and thie libs. Since each of those would have a dedicated directory, the original source tree is not needed anymore so can be deleted..

  • 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-15T09:52:58+00:00Added an answer on May 15, 2026 at 9:52 am

    Why not use file system links?

    ln -s /path/to/apis/apiA/include /path/to/api/include/apiA

    Voilá. Similar can be done on Windows, but I don’t have the command line handy right now.

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

Sidebar

Related Questions

I've heard a ton of complaining over the years about inherited projects that us
Over the years I have slowly developed a regular expression that validates most email
Over the years, I think I have seen and tried every conceivable way of
(This question is over 6 years old and probably no longer has any relevance.)
I have noted over the years, that I tend to write maybe a screen
I have noticed over the years that different developers have different criteria for what
I am soon to join a PHP project that has been developed over the
Over the years as I have gone through school and been working in the
Over the years, I have tried many times to find a good, easy to
Over the years most web developers will have built an arsenal of tools or

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.