Meta: Remove some obsolete cmake version checks

We require CMake 3.25 nowadays.

No behavior change.
This commit is contained in:
Nico Weber 2024-01-29 14:53:00 -05:00 committed by Tim Flynn
parent 22ea2f638a
commit 17f37cbd8c
Notes: sideshowbarker 2024-07-17 05:21:12 +09:00
4 changed files with 11 additions and 72 deletions

View file

@ -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}/../../.."

View file

@ -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!

View file

@ -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()

View file

@ -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()