From 6081ca441f8206ae06b526c7c8d88eb4af489d06 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Mon, 9 Mar 2020 13:06:23 +0100 Subject: [PATCH] Linux: test for recent libarchive/libcurl/lsblk The software requires at least: - libcurl 7.32.0 (released Aug 12 2013!) - libarchive 3.2.0 (released Apr 30 2016) - util-linux 2.27 (released Sep 7 2015) While technically we could build libcurl and libarchive statically (like we do for Mac and Windows) if the system has older libs, it's likely that running the software on systems that old may give other problems as well (e.g. does lsblk --json (util-linux) and udisks2 work correctly?), so do not bother. Closes #16 --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8193ee7..683d767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,10 +198,21 @@ elseif(APPLE) COMMAND "${MACDEPLOYQT}" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" -qmldir="${CMAKE_CURRENT_SOURCE_DIR}") else() - find_package(CURL REQUIRED) - find_package(LibArchive REQUIRED) + find_package(CURL REQUIRED 7.32.0) + find_package(LibArchive REQUIRED 3.2.0) find_package(Qt5 COMPONENTS DBus) set(EXTRALIBS Qt5::DBus) + if (NOT CMAKE_CROSSCOMPILING) + find_program(LSBLK "lsblk") + if (NOT LSBLK) + message(FATAL_ERROR "Unable to locate lsblk (used for disk enumeration)") + endif() + + execute_process(COMMAND "${LSBLK}" "--json" RESULT_VARIABLE ret) + if (ret EQUAL "1") + message(FATAL_ERROR "util-linux package too old. lsblk does not support --json (used for disk enumeration)") + endif() + endif() install(TARGETS rpi-imager DESTINATION bin) install(FILES icons/rpi-imager.png DESTINATION share/pixmaps)