Classic mode

vcpkg classic mode is less recommended than vcpkg manifest mode but remains a solid approach to compile Rat C++ libraries with vcpkg.

It allows to install packages globally using the local vcpkg repository which has been bootstrapped during the previous Setup section. All binaries then reside in this directory and all projects can share this same installation.

vcpkg classic mode however does not allow precise versioning of the packages to compile and install, unlike vcpkg manifest mode.

Consume packages

Using vcpkg classic mode the idea is to expose rat-vcpkg/ports as overlays by passing the --overlay-ports=ports flag to the install command to make vcpkg aware of these port definitions.

vcpkg solves dependencies quite neatly so one can try to install rat-models using the desired vcpkg triplet to get the whole dependency chain started (see Build and use for the VTK caveat).

git clone https://gitlab.com/project-rat-extras/rat-vcpkg.git
  • Run the following command from within the cloned Rat-vcpkg repository:

# Need to point to local Rat-vcpkg ports directory
vcpkg install rat-models:x64-windows-release --overlay-ports=ports --clean-after-build

# or if one needs to keep the buildtrees for debugging purposes
vcpkg install rat-models:x64-windows-release --overlay-ports=ports

This will install packages in the local vcpkg repository.

  • Ensure the VCPKG_ROOT environment variable is defined and points to the local vcpkg repository installation.

  • Configure a CMake project using the vcpkg toolchain file:

cd myproject
cmake -B build -S . -G "Ninja" `
    -DCMAKE_BUILD_TYPE="Release" `
    -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
    -DVCPKG_TARGET_TRIPLET="x64-windows-release" `
    -DVCPKG_HOST_TRIPLET="x64-windows-release"
  • Build the project:

cmake --build build