Where should I put third-party libraries?

后端 未结 3 1825
慢半拍i
慢半拍i 2021-02-05 16:46

I contribute to a decent-sized C++ project with a number of dependencies. The problem is, the project contains the source of all of its dependencies (e.g. pcre, zlib, etc.). I w

3条回答
  •  無奈伤痛
    2021-02-05 17:06

    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.

提交回复
热议问题