1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:17:47 +00:00

Meta: Error out on find_program errors with CMake less than 3.18

We have seen some cases where the build fails for folks, and they are
missing unzip/tar/gzip etc. We can catch some of these in CMake itself,
so lets make sure to handle that uniformly across the build system.

The REQUIRED flag to `find_program` was only added on in CMake 3.18 and
above, so we can't rely on that to actually halt the program execution.
This commit is contained in:
Brian Gianforcaro 2022-03-18 04:31:36 -07:00 committed by Brian Gianforcaro
parent 6b5f0d11ce
commit 66e7ac1954
6 changed files with 31 additions and 10 deletions

View file

@ -49,10 +49,7 @@ endif()
if (NOT HACKSTUDIO_BUILD)
# FIXME: With cmake 3.18, we can change unzip/untar steps to use
# file( ARCHIVE_EXTRACT) instead
find_program(UNZIP unzip REQUIRED)
find_program(TAR tar REQUIRED)
include(check_for_dependencies)
# Host tools, required to generate files for the build
find_package(Lagom CONFIG REQUIRED)
@ -309,7 +306,7 @@ endif()
if(EXISTS ${PCI_IDS_GZ_PATH} AND NOT EXISTS ${PCI_IDS_INSTALL_PATH})
message(STATUS "Extracting PCI ID database from ${PCI_IDS_GZ_PATH}...")
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
execute_process(COMMAND gzip -d -c "${PCI_IDS_GZ_PATH}" OUTPUT_FILE "${PCI_IDS_INSTALL_PATH}")
execute_process(COMMAND "${GZIP_TOOL}" -d -c "${PCI_IDS_GZ_PATH}" OUTPUT_FILE "${PCI_IDS_INSTALL_PATH}")
endif()
set(USB_IDS_FILE usb.ids)
@ -325,5 +322,5 @@ endif()
if(EXISTS ${USB_IDS_GZ_PATH} AND NOT EXISTS ${USB_IDS_INSTALL_PATH})
message(STATUS "Extracting USB ID database from ${USB_IDS_GZ_PATH}...")
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
execute_process(COMMAND gzip -d -c "${USB_IDS_GZ_PATH}" OUTPUT_FILE "${USB_IDS_INSTALL_PATH}")
execute_process(COMMAND "${GZIP_TOOL}" -d -c "${USB_IDS_GZ_PATH}" OUTPUT_FILE "${USB_IDS_INSTALL_PATH}")
endif()