From 7eae99223ec414bd7f579cde48d7857e453dbb24 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Jun 2018 06:11:39 -0400 Subject: [PATCH] CMake: check if rcc supports --format-version - The new format was introduced in Qt 5.7, and Qt 5.9 introduced the --format-version flag to rcc to switch back to the reproducible format 1. For distro's with Qt 5.7, don't use the new flag. - Reported from Neptune Linux, #979 --- CMakeModules/CalamaresAddTranslations.cmake | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CMakeModules/CalamaresAddTranslations.cmake b/CMakeModules/CalamaresAddTranslations.cmake index f5dd8c50c..924ee2483 100644 --- a/CMakeModules/CalamaresAddTranslations.cmake +++ b/CMakeModules/CalamaresAddTranslations.cmake @@ -22,6 +22,25 @@ include( CMakeParseArguments ) +if( NOT _rcc_version_support_checked ) + set( _rcc_version_support_checked TRUE ) + execute_process( + COMMAND echo "" + COMMAND ${Qt5Core_RCC_EXECUTABLE} --format-version 1 --list - + RESULT_VARIABLE _rcc_version_rv + ERROR_VARIABLE _rcc_version_dump + ) + message( STATUS "RCC ${_rcc_version_rv} ${_rcc_version_dump}" ) + if ( _rc_version_rv ) # Not zero + set( _rcc_version_support "" ) # Assume it is version 1 (Qt 5.7) or derpy (Qt 5.8) + else() + set( _rcc_version_support --format-version 1 ) + endif() + unset( _rcc_version_rv ) + unset( _rcc_version_dump ) +endif() + + # Internal macro for adding the C++ / Qt translations to the # build and install tree. Should be called only once, from # src/calamares/CMakeLists.txt. @@ -61,7 +80,7 @@ macro(add_calamares_translations language) add_custom_command( OUTPUT ${trans_outfile} COMMAND "${Qt5Core_RCC_EXECUTABLE}" - ARGS ${rcc_options} --format-version 1 -name ${trans_file} -o ${trans_outfile} ${trans_infile} + ARGS ${rcc_options} ${_rcc_version_support} -name ${trans_file} -o ${trans_outfile} ${trans_infile} MAIN_DEPENDENCY ${trans_infile} DEPENDS ${QM_FILES} )