VCPKG is a tool that can help your team effortlessly download and use C++ packages within your project, without worrying about dependencies or platforms.

Here's how to get started using it:

Project configuration (once per project)

We assume you are using cmake as your build system

  1. Open a terminal session and navigate to the root of your git project
  2. Add vcpkg's repository as a submodule:
git submodule add <https://github.com/microsoft/vcpkg>
git submodule init --update
  1. Add a vcpkg.json file to the root folder of your project with the following contents:
{
  "name": "your_project_name",
  "version-string": "0.1.0",
  "dependencies": [
    "openssl", //Add libraries name here to download & import them
  ]
}
  1. Add the following lines at the beginning of your CMakeLists.txt:
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
    set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
            CACHE STRING "")
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
        CACHE STRING "Vcpkg toolchain file")
  1. Commit your changes and that's it!
  2. (move on to First-use install and make sure all members in your team follow it too)
  3. Follow the Installing Packages section below for every package you add to vcpkg.json.

First-use install (everyone)

  1. Open a terminal session and navigate to the root of your project
  2. Run the following:

On Windows:

.\\vcpkg\\bootstrap-vcpkg.bat
.\\vcpkg\\vcpkg integrate install
.\\vcpkg\\vcpkg install

On MacOS/Linux:

./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg integrate install
./vcpkg/vcpkg install

<aside> ⚠️ If one of those commands fail, check the following:

</aside>