Skip to content

Instantly share code, notes, and snippets.

@jollyjonson
Created January 16, 2024 10:40
Show Gist options
  • Save jollyjonson/6d9b63f1603ebb501a72898ee845651e to your computer and use it in GitHub Desktop.
Save jollyjonson/6d9b63f1603ebb501a72898ee845651e to your computer and use it in GitHub Desktop.
Use CMake to automatically set up vcpkg as package manager using vcpkg-cmake-integration
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
# pull vcpkg-cmake-integration from github and let it set up vcpkg
include(FetchContent)
FetchContent_Declare(
vcpkg_cmake_integration
GIT_REPOSITORY https://github.com/bitmeal/vcpkg-cmake-integration.git
GIT_TAG origin/master # either manually specify a tag here (e.g. v0.2.2) or use latest master
)
FetchContent_MakeAvailable(vcpkg_cmake_integration)
include(${vcpkg_cmake_integration_SOURCE_DIR}/vcpkg.cmake)
# the project needs to be defined afterwards
project(MyProjectName)
# rest of the CMake goes here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment