Use FetchContent_MakeAvailable for vcpkg in case they add CMakeLists.txt

main
Duncan Ogilvie 3 years ago
parent 5768460827
commit 13255c68cf

@ -105,6 +105,8 @@ The vcpkg `version` will automatically generate the `url` from the [official rep
To specify package features you can use the following syntax: `imgui[docking-experimental,freetype,sdl2-binding,opengl3-binding]`. To specify package features you can use the following syntax: `imgui[docking-experimental,freetype,sdl2-binding,opengl3-binding]`.
The `crt-linkage` specifies the MSVC runtime library variant to use while compiling packages. `library-linkage` is whether libraries built are dynamic (default) or static.
## Packages ## Packages
```toml ```toml
@ -116,8 +118,6 @@ config = true
components = ["mycomponent"] components = ["mycomponent"]
``` ```
The `crt-linkage` specifies the MSVC runtime library variant to use while compiling packages. `library-linkage` is whether libraries built are dynamic (default) or static.
## FetchContent ## FetchContent
**Note**: The `[fetch-content]` feature is unpolished and will likely change in a future release. **Note**: The `[fetch-content]` feature is unpolished and will likely change in a future release.

@ -634,7 +634,10 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
cmd("include")("FetchContent"); cmd("include")("FetchContent");
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")..."); cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
cmd("FetchContent_Declare")("vcpkg", "URL", url); cmd("FetchContent_Declare")("vcpkg", "URL", url);
cmd("FetchContent_MakeAvailable")("vcpkg"); // Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt
cmd("FetchContent_GetProperties")("vcpkg");
cmd("if")("NOT", "vcpkg_POPULATED");
cmd("FetchContent_Populate")("vcpkg");
if (!project.vcpkg.crt_linkage.empty()) { if (!project.vcpkg.crt_linkage.empty()) {
cmd("set")("VCPKG_CRT_LINKAGE", project.vcpkg.crt_linkage); cmd("set")("VCPKG_CRT_LINKAGE", project.vcpkg.crt_linkage);
} }
@ -643,6 +646,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
} }
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake"); cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
cmd("endif")(); cmd("endif")();
cmd("endif")();
endl(); endl();
// clang-format on // clang-format on

Loading…
Cancel
Save