Suppress warnings related to DOWNLOAD_EXTRACT_TIMESTAMP

main
Duncan Ogilvie 2 years ago
parent f8c34e5545
commit 9d6897b572

@ -812,14 +812,20 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
// clang-format off // clang-format off
cmd("if")("CMKR_ROOT_PROJECT", "AND", "NOT", "CMKR_DISABLE_VCPKG"); cmd("if")("CMKR_ROOT_PROJECT", "AND", "NOT", "CMKR_DISABLE_VCPKG");
cmd("include")("FetchContent"); cmd("include")("FetchContent");
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")..."); comment("Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP");
cmd("FetchContent_Declare")("vcpkg", "URL", url); // clang-format off
// Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt cmd("if")("POLICY", "CMP0135");
cmd("FetchContent_GetProperties")("vcpkg"); cmd("cmake_policy")("SET", "CMP0135", "NEW");
cmd("if")("NOT", "vcpkg_POPULATED");
cmd("FetchContent_Populate")("vcpkg");
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
cmd("endif")(); cmd("endif")();
// clang-format on
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
cmd("FetchContent_Declare")("vcpkg", "URL", url);
// 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("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
cmd("endif")();
cmd("endif")(); cmd("endif")();
endl(); endl();
// clang-format on // clang-format on
@ -889,6 +895,14 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
if (!project.contents.empty()) { if (!project.contents.empty()) {
cmd("include")("FetchContent").endl(); cmd("include")("FetchContent").endl();
if (!project.root()->vcpkg.enabled()) {
comment("Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP");
// clang-format off
cmd("if")("POLICY", "CMP0135");
cmd("cmake_policy")("SET", "CMP0135", "NEW");
cmd("endif")();
// clang-format on
}
for (const auto &content : project.contents) { for (const auto &content : project.contents) {
ConditionScope cs(gen, content.condition); ConditionScope cs(gen, content.condition);

@ -51,4 +51,4 @@ condition = "msvc"
name = "msvc-runtime" name = "msvc-runtime"
working-directory = "msvc-runtime" working-directory = "msvc-runtime"
command = "$<TARGET_FILE:cmkr>" command = "$<TARGET_FILE:cmkr>"
arguments = ["build"] arguments = ["build"]

Loading…
Cancel
Save