Skip to content

Commit 9d6897b

Browse files
committed
Suppress warnings related to DOWNLOAD_EXTRACT_TIMESTAMP
1 parent f8c34e5 commit 9d6897b

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/cmake_generator.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,14 +812,20 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
812812
// clang-format off
813813
cmd("if")("CMKR_ROOT_PROJECT", "AND", "NOT", "CMKR_DISABLE_VCPKG");
814814
cmd("include")("FetchContent");
815-
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
816-
cmd("FetchContent_Declare")("vcpkg", "URL", url);
817-
// Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt
818-
cmd("FetchContent_GetProperties")("vcpkg");
819-
cmd("if")("NOT", "vcpkg_POPULATED");
820-
cmd("FetchContent_Populate")("vcpkg");
821-
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
815+
comment("Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP");
816+
// clang-format off
817+
cmd("if")("POLICY", "CMP0135");
818+
cmd("cmake_policy")("SET", "CMP0135", "NEW");
822819
cmd("endif")();
820+
// clang-format on
821+
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
822+
cmd("FetchContent_Declare")("vcpkg", "URL", url);
823+
// Not using FetchContent_MakeAvailable here in case vcpkg adds CMakeLists.txt
824+
cmd("FetchContent_GetProperties")("vcpkg");
825+
cmd("if")("NOT", "vcpkg_POPULATED");
826+
cmd("FetchContent_Populate")("vcpkg");
827+
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");
828+
cmd("endif")();
823829
cmd("endif")();
824830
endl();
825831
// clang-format on
@@ -889,6 +895,14 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
889895

890896
if (!project.contents.empty()) {
891897
cmd("include")("FetchContent").endl();
898+
if (!project.root()->vcpkg.enabled()) {
899+
comment("Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP");
900+
// clang-format off
901+
cmd("if")("POLICY", "CMP0135");
902+
cmd("cmake_policy")("SET", "CMP0135", "NEW");
903+
cmd("endif")();
904+
// clang-format on
905+
}
892906
for (const auto &content : project.contents) {
893907
ConditionScope cs(gen, content.condition);
894908

tests/cmake.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ condition = "msvc"
5151
name = "msvc-runtime"
5252
working-directory = "msvc-runtime"
5353
command = "$<TARGET_FILE:cmkr>"
54-
arguments = ["build"]
54+
arguments = ["build"]

0 commit comments

Comments
 (0)