From c6e3fc159fa029be8b930888eb1f39c955587bca Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 2 Dec 2024 15:50:22 +0100 Subject: [PATCH 1/2] Suppress deprecation warning for CMake <3.10 --- CMakeLists.txt | 2 +- cmake.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bc84e0..ea49a95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # This file is automatically generated from cmake.toml - DO NOT EDIT # See https://github.com/build-cpp/cmkr for more information -cmake_minimum_required(VERSION 2.8...3.8) +cmake_minimum_required(VERSION 2.8...3.31) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build") diff --git a/cmake.toml b/cmake.toml index 28d922c..f62fbbb 100644 --- a/cmake.toml +++ b/cmake.toml @@ -1,5 +1,5 @@ [cmake] -version = "2.8...3.8" +version = "2.8...3.31" cmkr-include = false [project] From e12ebc060db075f0ceb9d1ae69606a775895dfd6 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 2 Dec 2024 15:54:19 +0100 Subject: [PATCH 2/2] Use FetchContent_MakeAvailable for vcpkg --- src/cmake_generator.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cmake_generator.cpp b/src/cmake_generator.cpp index 808229e..8153038 100644 --- a/src/cmake_generator.cpp +++ b/src/cmake_generator.cpp @@ -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