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.
This commit is contained in:
parent
38b347f8f2
commit
bfa1f618c7
@ -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 "<RCC version='1.0'></RCC>"
|
||||
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 "<!DOCTYPE RCC><RCC version=\"1.0\">\n" )
|
||||
|
||||
# calamares and qt language files
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user