Skip to content

Instantly share code, notes, and snippets.

@avetharun
Last active March 30, 2025 22:53
Show Gist options
  • Save avetharun/b42ed4df7f708651d6fa8a1f86422e2a to your computer and use it in GitHub Desktop.
Save avetharun/b42ed4df7f708651d6fa8a1f86422e2a to your computer and use it in GitHub Desktop.
Single-line vcpkg CMake definition
# Options of including:
# Inline
cmake_minimum_required (VERSION ...)
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "VCPKG toolchain file")
...
...
project("...")
# included via external file
cmake_minimum_required (VERSION ...)
include("vcpkg.cmake")
...
...
project("...")
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "VCPKG toolchain file")

Comments are disabled for this gist.