Skip to content

Commit

Permalink
Merge pull request #165 from build-cpp/cmake-support
Browse files Browse the repository at this point in the history
Fix vcpkg support for CMake 3.30
  • Loading branch information
mrexodia authored Dec 2, 2024
2 parents dc6f306 + e12ebc0 commit 45e12c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmake.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[cmake]
version = "2.8...3.8"
version = "2.8...3.31"
cmkr-include = false

[project]
Expand Down
12 changes: 4 additions & 8 deletions src/cmake_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,15 +943,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
cmd("endif")();
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
cmd("FetchContent_Declare")("vcpkg", vcpkg_args);
// Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt
cmd("FetchContent_GetProperties")("vcpkg");
cmd("if")("NOT", "vcpkg_POPULATED");
cmd("FetchContent_Populate")("vcpkg");
cmd("if")("CMAKE_HOST_SYSTEM_NAME", "STREQUAL", "Darwin", "AND", "CMAKE_OSX_ARCHITECTURES", "STREQUAL", RawArg("\"\""));
cmd("set")("CMAKE_OSX_ARCHITECTURES", "${CMAKE_HOST_SYSTEM_PROCESSOR}", "CACHE", "STRING", RawArg("\"\""), "FORCE");
cmd("endif")();
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
cmd("FetchContent_MakeAvailable")("vcpkg").endl();
cmd("if")("CMAKE_HOST_SYSTEM_NAME", "STREQUAL", "Darwin", "AND", "CMAKE_OSX_ARCHITECTURES", "STREQUAL", RawArg("\"\""));
cmd("set")("CMAKE_OSX_ARCHITECTURES", "${CMAKE_HOST_SYSTEM_PROCESSOR}", "CACHE", "STRING", RawArg("\"\""), "FORCE");
cmd("endif")();
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
cmd("endif")();
endl();
// clang-format on
Expand Down

0 comments on commit 45e12c8

Please sign in to comment.