From 17f37cbd8cb2f6cc0885f13f183ca4adb0abb33f Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 29 Jan 2024 14:53:00 -0500 Subject: [PATCH] Meta: Remove some obsolete cmake version checks We require CMake 3.25 nowadays. No behavior change. --- Meta/CMake/Superbuild/CMakeLists.txt | 24 ++++-------------------- Meta/CMake/check_for_dependencies.cmake | 23 +---------------------- Meta/CMake/time_zone_data.cmake | 12 ++---------- Meta/CMake/utils.cmake | 24 ++++-------------------- 4 files changed, 11 insertions(+), 72 deletions(-) diff --git a/Meta/CMake/Superbuild/CMakeLists.txt b/Meta/CMake/Superbuild/CMakeLists.txt index cac282a9459..17d2d3797a8 100644 --- a/Meta/CMake/Superbuild/CMakeLists.txt +++ b/Meta/CMake/Superbuild/CMakeLists.txt @@ -7,26 +7,10 @@ project( ) # NOTE: Before CMake 3.19, if a custom command is attached to multiple step targets for Makefile and Visual Studio generators, -# it might be run multiple times during the build. Enable new behavior of policy CMP0114 to avoid this, or apply the -# workaround from https://gitlab.kitware.com/cmake/cmake/-/issues/18663#note_489967 -if(NOT CMAKE_VERSION VERSION_LESS "3.19") - cmake_policy(SET CMP0114 NEW) - macro(ensure_dependencies) - endmacro() -else() - macro(ensure_dependencies proj) - foreach(step IN ITEMS configure build install) - if(NOT TARGET "${proj}-${step}") - ExternalProject_Add_StepTargets("${proj}" "${step}") - endif() - if(step STREQUAL "install") - ExternalProject_Add_StepDependencies("${proj}" install "${proj}-build") - elseif(step STREQUAL "build") - ExternalProject_Add_StepDependencies("${proj}" build "${proj}-configure") - endif() - endforeach() - endmacro() -endif() +# it might be run multiple times during the build. Enable new behavior of policy CMP0114 to avoid this. +cmake_policy(SET CMP0114 NEW) +macro(ensure_dependencies) +endmacro() get_filename_component( SERENITY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../.." diff --git a/Meta/CMake/check_for_dependencies.cmake b/Meta/CMake/check_for_dependencies.cmake index bedde21f8e9..12ee0cd92a4 100644 --- a/Meta/CMake/check_for_dependencies.cmake +++ b/Meta/CMake/check_for_dependencies.cmake @@ -2,25 +2,4 @@ # Check for the dependencies that the Serenity (target) and Lagom (host) builds require. # -# FIXME: With cmake 3.18, we can change unzip/untar/gzip steps to use -# file( ARCHIVE_EXTRACT) instead -# -# Additionally we have to emit an error message for each tool, -# as REQUIRED only works with cmake 3.18 and above. -if (CMAKE_VERSION VERSION_LESS 3.18.0) - find_program(UNZIP_TOOL unzip REQUIRED) - message(STATUS "Found cmake ${CMAKE_VERSION} - testing for external tools to uncompress") - if (NOT UNZIP_TOOL) - message(FATAL_ERROR "Failed to locate unzip on your machine, please install it and re-read the SerenityOS build documentation.") - endif() - - find_program(TAR_TOOL tar REQUIRED) - if (NOT TAR_TOOL) - message(FATAL_ERROR "Failed to locate tar on your machine, please install it and re-read the SerenityOS build documentation.") - endif() - - find_program(GZIP_TOOL gzip REQUIRED) - if (NOT GZIP_TOOL) - message(FATAL_ERROR "Failed to locate gzip on your machine, please install it and re-read the SerenityOS build documentation.") - endif() -endif() +# None at the moment! diff --git a/Meta/CMake/time_zone_data.cmake b/Meta/CMake/time_zone_data.cmake index 70ca23a0ee9..693caee15be 100644 --- a/Meta/CMake/time_zone_data.cmake +++ b/Meta/CMake/time_zone_data.cmake @@ -40,16 +40,8 @@ set(TZDB_ZONE_1970_PATH "${TZDB_PATH}/${TZDB_ZONE_1970_SOURCE}") function(extract_tzdb_file source path) if(EXISTS "${TZDB_ZIP_PATH}" AND NOT EXISTS "${path}") - if (CMAKE_VERSION VERSION_LESS 3.18.0) - message(STATUS "Extracting using ${TAR_TOOL} file ${source}") - execute_process(COMMAND "${TAR_TOOL}" -C "${TZDB_PATH}" -xzf "${TZDB_ZIP_PATH}" "${source}" RESULT_VARIABLE tar_result) - if (NOT tar_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${source} from ${TZDB_ZIP_PATH} with status ${tar_result}") - endif() - else() - message(STATUS "Extracting using cmake ${source}") - file(ARCHIVE_EXTRACT INPUT "${TZDB_ZIP_PATH}" DESTINATION "${TZDB_PATH}" PATTERNS "${source}") - endif() + message(STATUS "Extracting using cmake ${source}") + file(ARCHIVE_EXTRACT INPUT "${TZDB_ZIP_PATH}" DESTINATION "${TZDB_PATH}" PATTERNS "${source}") endif() endfunction() diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake index 822658144c1..c2362adc8f1 100644 --- a/Meta/CMake/utils.cmake +++ b/Meta/CMake/utils.cmake @@ -258,30 +258,14 @@ endfunction() function(extract_path dest_dir zip_path source_path dest_path) if (EXISTS "${zip_path}" AND NOT EXISTS "${dest_path}") - if (CMAKE_VERSION VERSION_LESS 3.18.0) - message(STATUS "Extracting using ${UNZIP_TOOL} ${source_path} from ${zip_path}") - execute_process(COMMAND "${UNZIP_TOOL}" -q "${zip_path}" "${source_path}" -d "${dest_dir}" RESULT_VARIABLE unzip_result) - if (NOT unzip_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${source_path} from ${zip_path} with status ${unzip_result}") - endif() - else() - message(STATUS "Extracting using cmake ${source_path}") - file(ARCHIVE_EXTRACT INPUT "${zip_path}" DESTINATION "${dest_dir}" PATTERNS "${source_path}") - endif() + message(STATUS "Extracting using cmake ${source_path}") + file(ARCHIVE_EXTRACT INPUT "${zip_path}" DESTINATION "${dest_dir}" PATTERNS "${source_path}") endif() endfunction() function(extract_tar_path dest_dir tar_path source_path dest_path) if (EXISTS "${tar_path}" AND NOT EXISTS "${dest_path}") - if (CMAKE_VERSION VERSION_LESS 3.18.0) - message(STATUS "Extracting using ${TAR_TOOL} ${source_path} from ${tar_path}") - execute_process(COMMAND "${TAR_TOOL}" -xf "${tar_path}" -C "${dest_dir}" "${source_path}" RESULT_VARIABLE untar_result) - if (NOT untar_result EQUAL 0) - message(FATAL_ERROR "Failed to untar ${source_path} from ${tar_path} with status ${untar_result}") - endif() - else() - message(STATUS "Extracting using cmake ${source_path}") - file(ARCHIVE_EXTRACT INPUT "${tar_path}" DESTINATION "${dest_dir}" PATTERNS "${source_path}") - endif() + message(STATUS "Extracting using cmake ${source_path}") + file(ARCHIVE_EXTRACT INPUT "${tar_path}" DESTINATION "${dest_dir}" PATTERNS "${source_path}") endif() endfunction()