Repository navigation
Reworked the vcpkg templates. - #27
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reworks the “with_vcpkg” templates to prepare vcpkg from within CMake (via a new prepare_vcpkg() helper) instead of relying on separate bootstrap scripts, and updates presets/CI accordingly.
Changes:
- Adds
prepare_vcpkg()to the vcpkg-based templates and calls it beforeproject()so it can set vcpkg/toolchain-related variables early. - Removes vcpkg bootstrap scripts and drops toolchain/installed-dir preset variables, relying on the new CMake-side preparation instead.
- Updates CI to stop running per-template bootstrap scripts before running CMake workflows.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| readme.md | Removes bootstrap-script step from setup instructions for vcpkg templates. |
| library_with_vcpkg/CMakePresets.json | Removes vcpkg toolchain/installed-dir cache variables from presets. |
| library_with_vcpkg/CMakeLists.txt | Calls prepare_vcpkg() before project(). |
| library_with_vcpkg/cmake/extensions.cmake | Introduces prepare_vcpkg() implementation (clone/bootstrap + toolchain setup). |
| library_with_vcpkg/bootstrap.sh | Removes legacy bootstrap script. |
| library_with_vcpkg/bootstrap.bat | Removes legacy bootstrap script. |
| header_only_library_with_vcpkg/CMakePresets.json | Removes vcpkg toolchain/installed-dir cache variables from presets. |
| header_only_library_with_vcpkg/CMakeLists.txt | Calls prepare_vcpkg() before project(). |
| header_only_library_with_vcpkg/cmake/extensions.cmake | Introduces prepare_vcpkg() implementation (clone/bootstrap + toolchain setup). |
| header_only_library_with_vcpkg/bootstrap.sh | Removes legacy bootstrap script. |
| header_only_library_with_vcpkg/bootstrap.bat | Removes legacy bootstrap script. |
| executable_with_vcpkg/vcpkg.json | Whitespace cleanup in manifest template. |
| executable_with_vcpkg/CMakePresets.json | Removes vcpkg toolchain/installed-dir cache variables from presets. |
| executable_with_vcpkg/CMakeLists.txt | Calls prepare_vcpkg() before project(). |
| executable_with_vcpkg/cmake/extensions.cmake | Introduces prepare_vcpkg() implementation (clone/bootstrap + toolchain setup). |
| executable_with_vcpkg/bootstrap.sh | Removes legacy bootstrap script. |
| executable_with_vcpkg/bootstrap.bat | Removes legacy bootstrap script. |
| CMakePresets.json | Removes repository-root presets file. |
| CMakeLists.txt | Removes repository-root superbuild file. |
| .gitignore | Removes repository-root ignore file. |
| .github/workflows/ci.yml | Removes explicit vcpkg bootstrap steps from CI matrix. |
Suppressed comments (3)
library_with_vcpkg/cmake/extensions.cmake:100
prepare_vcpkg()writesCMAKE_TOOLCHAIN_FILEinto the cache pointing into the downloaded vcpkg checkout. On the next configure, CMake will try to load the toolchain file before it executes this function, so ifbuild/vcpkghas been deleted/moved the configure will fail before it can self-heal. Setting the toolchain file as a normal variable (beforeproject()) avoids this trap while still enabling vcpkg for the current configure.
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "VCPKG toolchain file.")
endfunction ()
header_only_library_with_vcpkg/cmake/extensions.cmake:100
prepare_vcpkg()writesCMAKE_TOOLCHAIN_FILEinto the cache pointing into the downloaded vcpkg checkout. On the next configure, CMake will try to load the toolchain file before it executes this function, so ifbuild/vcpkghas been deleted/moved the configure will fail before it can self-heal. Setting the toolchain file as a normal variable (beforeproject()) avoids this trap while still enabling vcpkg for the current configure.
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "VCPKG toolchain file.")
endfunction ()
executable_with_vcpkg/cmake/extensions.cmake:91
prepare_vcpkg()writesCMAKE_TOOLCHAIN_FILEinto the cache pointing into the downloaded vcpkg checkout. On the next configure, CMake will try to load the toolchain file before it executes this function, so ifbuild/vcpkghas been deleted/moved the configure will fail before it can self-heal. Setting the toolchain file as a normal variable (beforeproject()) avoids this trap while still enabling vcpkg for the current configure.
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "VCPKG toolchain file.")
endfunction ()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.