Search code examples
c++linuxpackage-managersvcpkgpackage-management

Do C++ package managers make seperate copies of dependent libraries?


I was getting familiar with vcpkg for C++ package manager in linux(ubuntu). Maybe I am not understanding something but it seems like vcpkg is making copies of dependencies. Example if I want to use SDL2 for 10 projects , vcpkg will make 10 copies of SDL2 for each project. Can anyone explain me what is going on?

I would rather install SDL2 system wide and utilize one file for 10 projects.

What am I missing? I am very new to programming to please forgive me if this was a stupid question.


Solution

  • Can anyone explain me what is going on?

    vcpkg is designed to isolate project artifacts from another in manifest mode. As such it will perform an installation per project. If you want to use vcpkg in a "shared" manner you have to rely on classic mode and point your project to the classic mode installation.
    However, be aware that this is not the only difference between manifest mode and classic mode. In classic mode the installed tree is more or less fixed on install while in manifest mode the current state of the ports abi will be re-evaluated on configure and if something changed the tree will be re-installed and updated which protects from having a mixed version of the vcpkg installed tree (unless you are explicitly asking for it via the versioning feature in manifest mode)