From 51bc4f59a798101bd05f4e9d8c6a9b736cfb70ef Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Mon, 9 Dec 2024 09:00:35 -0600 Subject: [PATCH 1/3] cstest: use DOWNLOAD_EXTRACT_TIMESTAMP conditionally This feature was added in CMake 3.24.0, so this allows older CMakes to still build the tests. --- suite/cstest/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/suite/cstest/CMakeLists.txt b/suite/cstest/CMakeLists.txt index 51bcae1eb3..77fa46a34c 100644 --- a/suite/cstest/CMakeLists.txt +++ b/suite/cstest/CMakeLists.txt @@ -5,11 +5,16 @@ find_library(libyaml NAMES libyaml yaml REQUIRED) set(CMOCKA_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/extern/src/cmocka_ext-build/src/libcmocka.a") + +if(CMAKE_VERSION VERSION_GREATER "3.24.0") + set(DOWNLOAD_EXTRACT_TIMESTAMP "DOWNLOAD_EXTRACT_TIMESTAMP true") +endif() + ExternalProject_Add(cmocka_ext PREFIX extern URL "https://cmocka.org/files/1.1/cmocka-1.1.7.tar.xz" URL_HASH SHA256=810570eb0b8d64804331f82b29ff47c790ce9cd6b163e98d47a4807047ecad82 - DOWNLOAD_EXTRACT_TIMESTAMP true + ${DOWNLOAD_EXTRACT_TIMESTAMP} CONFIGURE_COMMAND cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ../cmocka_ext/ BUILD_COMMAND cmake --build . --config Release BUILD_BYPRODUCTS "${CMOCKA_LIB_FILE}" @@ -27,7 +32,7 @@ ExternalProject_Add(libcyaml_ext PREFIX extern URL "https://github.com/tlsa/libcyaml/archive/refs/tags/v1.4.2.tar.gz" URL_HASH SHA256=3211b2a0589ebfe02c563c96adce9246c0787be2af30353becbbd362998d16dc - DOWNLOAD_EXTRACT_TIMESTAMP true + ${DOWNLOAD_EXTRACT_TIMESTAMP} CONFIGURE_COMMAND "" BUILD_COMMAND make VARIANT=${LIBCYAML_VARIANT} PKG_CONFIG=pkg-config BUILD_BYPRODUCTS "${LIBCYAML_LIB_FILE}" From 7de3fb0e1093ad06425e1a666ea7018665135f64 Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Mon, 9 Dec 2024 10:01:56 -0600 Subject: [PATCH 2/3] Fix comparison --- suite/cstest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suite/cstest/CMakeLists.txt b/suite/cstest/CMakeLists.txt index 77fa46a34c..a271687ced 100644 --- a/suite/cstest/CMakeLists.txt +++ b/suite/cstest/CMakeLists.txt @@ -6,7 +6,7 @@ find_library(libyaml REQUIRED) set(CMOCKA_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/extern/src/cmocka_ext-build/src/libcmocka.a") -if(CMAKE_VERSION VERSION_GREATER "3.24.0") +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") set(DOWNLOAD_EXTRACT_TIMESTAMP "DOWNLOAD_EXTRACT_TIMESTAMP true") endif() From 809f493a0fc3d1852c556f8a9023d0a792689093 Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Mon, 9 Dec 2024 10:26:41 -0600 Subject: [PATCH 3/3] Use POLICY CMP0135 --- suite/cstest/CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/suite/cstest/CMakeLists.txt b/suite/cstest/CMakeLists.txt index a271687ced..53a33f0612 100644 --- a/suite/cstest/CMakeLists.txt +++ b/suite/cstest/CMakeLists.txt @@ -1,20 +1,20 @@ cmake_minimum_required(VERSION 3.15) +# Enable DOWNLOAD_EXTRACT_TIMESTAMP +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() + include(ExternalProject) find_library(libyaml NAMES libyaml yaml REQUIRED) set(CMOCKA_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/extern/src/cmocka_ext-build/src/libcmocka.a") -if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") - set(DOWNLOAD_EXTRACT_TIMESTAMP "DOWNLOAD_EXTRACT_TIMESTAMP true") -endif() - ExternalProject_Add(cmocka_ext PREFIX extern URL "https://cmocka.org/files/1.1/cmocka-1.1.7.tar.xz" URL_HASH SHA256=810570eb0b8d64804331f82b29ff47c790ce9cd6b163e98d47a4807047ecad82 - ${DOWNLOAD_EXTRACT_TIMESTAMP} CONFIGURE_COMMAND cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ../cmocka_ext/ BUILD_COMMAND cmake --build . --config Release BUILD_BYPRODUCTS "${CMOCKA_LIB_FILE}" @@ -32,7 +32,6 @@ ExternalProject_Add(libcyaml_ext PREFIX extern URL "https://github.com/tlsa/libcyaml/archive/refs/tags/v1.4.2.tar.gz" URL_HASH SHA256=3211b2a0589ebfe02c563c96adce9246c0787be2af30353becbbd362998d16dc - ${DOWNLOAD_EXTRACT_TIMESTAMP} CONFIGURE_COMMAND "" BUILD_COMMAND make VARIANT=${LIBCYAML_VARIANT} PKG_CONFIG=pkg-config BUILD_BYPRODUCTS "${LIBCYAML_LIB_FILE}"