From bfa1f618c7aade57bd2c51b11293ecf4931c765e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Jul 2020 17:36:10 +0200 Subject: [PATCH] CMake: Improve RCC version-checking Previously, we check for RCC support every single time CMake runs. This is slightly wasteful, and it wasn't being done right anyway. But it's moot because: - Calamares supports back to Qt 5.9 - Qt 5.9's version of rcc (at least, 5.9.7) **does** support the command-line argument `--format-version 1` - Everything newer does too. Simplify translations a little, too: just use autorcc rather than building things by hand. --- CMakeModules/CalamaresAddTranslations.cmake | 36 ++------------------- src/calamares/CMakeLists.txt | 4 +-- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/CMakeModules/CalamaresAddTranslations.cmake b/CMakeModules/CalamaresAddTranslations.cmake index bb15fb122..88992faf5 100644 --- a/CMakeModules/CalamaresAddTranslations.cmake +++ b/CMakeModules/CalamaresAddTranslations.cmake @@ -22,46 +22,14 @@ include( CMakeParseArguments ) -if( NOT _rcc_version_support_checked ) - set( _rcc_version_support_checked TRUE ) - - # Extract the executable name - get_property( _rcc_executable - TARGET ${Qt5Core_RCC_EXECUTABLE} - PROPERTY IMPORTED_LOCATION - ) - if( NOT _rcc_executable ) - # Weird, probably now uses Qt5::rcc which is wrong too - set( _rcc_executable ${Qt5Core_RCC_EXECUTABLE} ) - endif() - - # Try an empty RCC file with explicit format-version - execute_process( - COMMAND echo "" - COMMAND ${Qt5Core_RCC_EXECUTABLE} --format-version 1 --list - - RESULT_VARIABLE _rcc_version_rv - ERROR_VARIABLE _rcc_version_dump - ) - if ( _rcc_version_rv EQUAL 0 ) - # Supported: force to the reproducible version - set( _rcc_version_support --format-version 1 ) - else() - # Older Qt versions (5.7, 5.8) don't support setting the - # rcc format-version, so won't be reproducible if they - # default to version 2. - set( _rcc_version_support "" ) - 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. macro(add_calamares_translations language) list( APPEND CALAMARES_LANGUAGES ${ARGV} ) + set( _rcc_version_support --format-version 1 ) + set( calamares_i18n_qrc_content "\n" ) # calamares and qt language files diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index b632567b8..ff91904e2 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -34,9 +34,8 @@ include_directories( # Translations include( CalamaresAddTranslations ) add_calamares_translations( ${CALAMARES_TRANSLATION_LANGUAGES} ) -qt5_add_resources( calamaresRc calamares.qrc ) -add_executable( calamares_bin ${calamaresSources} ${calamaresRc} ${trans_outfile} ) +add_executable( calamares_bin ${calamaresSources} calamares.qrc ${trans_outfile} ) target_include_directories( calamares_bin PRIVATE ${CMAKE_SOURCE_DIR} ) set_target_properties(calamares_bin PROPERTIES @@ -45,6 +44,7 @@ set_target_properties(calamares_bin ) calamares_automoc( calamares_bin ) calamares_autouic( calamares_bin ) +calamares_autorcc( calamares_bin ) target_link_libraries( calamares_bin PRIVATE