Where should I put third-party libraries? Where should I put third-party libraries? windows windows

Where should I put third-party libraries?


A structure that we use on my workplace is having one "External" folder that contains an "Include" and a "Lib" folder for the headers and external Libs. However, as we also use VS, we try to use its "Dependencies" feature as most as possible, removing manual inputs to the linker. That means only projects that are not under the same solution goes to the "External" folder. Also, as we have some third-party libraries specific to some projects, we create folders inside the project folder for these includes and libs. This is how it gets:

.\|-Project1\ --> contains Project1.vcproj|-Project2\ --> contains Project2.vcproj| |-Third-Party\|   |-Include\|   |-Lib\|-External\| |-Include\| |-Lib\|-InternalLibrary\ --> contains InternalLibrary.vcproj|-Solution.sln --> includes the vcproj's and link them as necessary by its dependencies

I can't tell if this is the best structure ever, but everything is under source control, we can do night builds just by building the solution, and development goes by building single projects.


There's a fallacy in your statement: "I want to trim the project down to just what's relevant to the program itself."

Believe me, the dependencies are extremely relevant to the program. If you don't have these in source control then you will encounter no end of problems when introducing new team members or when switching to a new workstation.

Even if compile the "non-relevant" libraries, these compiled libraries should go into your source repository.


I've seen groups do the following:

  • Separate internal code from external code (code they made vs external companies)
  • Separate their code from library code
  • Separate each program and each library
  • Check in a compiled version of their dependencies, so it isn't a part of their full build cycle (at least, not in some branches. Other branches might do a more complete build)

Projects existed for each exe or library, in the directory with the exe/library.

Solutions existed wherever the teams felt it would be beneficial, and binaries were often linked, rather than their projects included in the sub-solutions. Only a full build was guaranteed not to break on a fresh enlistment.

Caveat emptor...