diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-04-15 16:41:02 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-04-16 16:49:28 +0200 |
commit | f4417bf7e8f843438345f496cf5d6a9b6fa33709 (patch) | |
tree | 502ea3d41257505a9c899ebab75d13ab9a97cfcf /configure.cmake | |
parent | 5656a60dd067a69f9e864a33068ec300124d4e05 (diff) |
Check whether CMake was built with zstd support
CMake 3.18 introduced the file(ARCHIVE_CREATE) API that we use with
COMPRESSION Zstd for compressing corelib's mimedatabase.
It's possible to build CMake without proper zstd support, and we have
encountered such builds in the wild where the file(ARCHIVE_CREATE) call
crashes.
Add a configure test to determine whether CMake properly supports the
Zstd compression method.
Fixes: QTBUG-89108
Change-Id: I37e389c878845162b6f18457984d4f73a265b604
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'configure.cmake')
-rw-r--r-- | configure.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake index 840d5f586c..cfd355dcfe 100644 --- a/configure.cmake +++ b/configure.cmake @@ -830,6 +830,24 @@ qt_feature("zstd" PRIVATE LABEL "Zstandard support" CONDITION ZSTD_FOUND ) +# special case begin +# Check whether CMake was built with zstd support. +# See https://gitlab.kitware.com/cmake/cmake/-/issues/21552 +if(NOT DEFINED CACHE{QT_CMAKE_ZSTD_SUPPORT}) + set(QT_CMAKE_ZSTD_SUPPORT FALSE CACHE INTERNAL "") + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18") + execute_process(COMMAND "${CMAKE_COMMAND}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/cmake_zstd/check_zstd.cmake" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/config.tests" + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE qt_check_zstd_exit_code) + if(qt_check_zstd_exit_code EQUAL 0) + set(QT_CMAKE_ZSTD_SUPPORT TRUE CACHE INTERNAL "") + endif() + unset(qt_check_zstd_exit_code) + endif() +endif() +# special case end qt_feature("thread" PUBLIC SECTION "Kernel" LABEL "Thread support" |