@ -22,50 +22,15 @@
include ( CMakeParseArguments )
if ( NOT _rcc_version_support_checked )
set ( _rcc_version_support_checked TRUE )
# E x t r a c t t h e e x e c u t a b l e n a m e
get_property ( _rcc_executable
T A R G E T $ { Q t 5 C o r e _ R C C _ E X E C U T A B L E }
P R O P E R T Y I M P O R T E D _ L O C A T I O N
)
if ( NOT _rcc_executable )
# W e i r d , p r o b a b l y n o w u s e s Q t 5 : : r c c w h i c h i s w r o n g t o o
set ( _rcc_executable ${ Qt5Core_RCC_EXECUTABLE } )
endif ( )
# T r y a n e m p t y R C C f i l e w i t h e x p l i c i t f o r m a t - v e r s i o n
execute_process (
C O M M A N D e c h o " < R C C v e r s i o n = ' 1 . 0 ' > < / R C C > "
C O M M A N D $ { Q t 5 C o r e _ R C C _ E X E C U T A B L E } - - f o r m a t - v e r s i o n 1 - - l i s t -
R E S U L T _ V A R I A B L E _ r c c _ v e r s i o n _ r v
E R R O R _ V A R I A B L E _ r c c _ v e r s i o n _ d u m p
)
if ( _rcc_version_rv EQUAL 0 )
# S u p p o r t e d : f o r c e t o t h e r e p r o d u c i b l e v e r s i o n
set ( _rcc_version_support --format-version 1 )
else ( )
# O l d e r Q t versions ( 5.7, 5.8 ) d o n ' t s u p p o r t s e t t i n g t h e
# r c c f o r m a t - v e r s i o n , s o w o n ' t b e r e p r o d u c i b l e i f t h e y
# d e f a u l t t o v e r s i o n 2 .
set ( _rcc_version_support "" )
endif ( )
unset ( _rcc_version_rv )
unset ( _rcc_version_dump )
endif ( )
# I n t e r n a l m a c r o f o r a d d i n g t h e C + + / Q t t r a n s l a t i o n s t o t h e
# b u i l d a n d i n s t a l l t r e e . S h o u l d b e c a l l e d o n l y o n c e , f r o m
# s r c / c a l a m a r e s / C M a k e L i s t s . t x t .
macro ( add_calamares_translations language )
list ( APPEND CALAMARES_LANGUAGES ${ ARGV } )
set ( calamares_i18n_qrc_content " <!DOCTYPE RCC><RCC version=\"1.0\ ">\n " )
set ( calamares_i18n_qrc_content "" )
# c a l a m a r e s a n d q t l a n g u a g e f i l e s
set ( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}<qresource prefix=\" /lang\ ">\n" )
foreach ( lang ${ CALAMARES_LANGUAGES } )
foreach ( tlsource "calamares_${lang}" "tz_${lang}" )
if ( EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" )
@ -75,31 +40,19 @@ macro(add_calamares_translations language)
endforeach ( )
endforeach ( )
set ( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}</qresource>\n" )
set ( calamares_i18n_qrc_content "${calamares_i18n_qrc_content}</RCC>\n" )
file ( WRITE ${ CMAKE_BINARY_DIR } /lang/calamares_i18n.qrc "${calamares_i18n_qrc_content}" )
qt5_add_translation ( QM_FILES ${ TS_FILES } )
# # H A C K H A C K H A C K - a r o u n d r c c l i m i t a t i o n s t o a l l o w o u t o f s o u r c e - t r e e b u i l d i n g
set ( trans_file calamares_i18n )
set ( trans_srcfile ${ CMAKE_BINARY_DIR } /lang/ ${ trans_file } .qrc )
set ( trans_infile ${ CMAKE_CURRENT_BINARY_DIR } / ${ trans_file } .qrc )
set ( trans_outfile ${ CMAKE_CURRENT_BINARY_DIR } /qrc_ ${ trans_file } .cxx )
# C o p y t h e Q R C f i l e t o t h e o u t p u t d i r e c t o r y
add_custom_command (
O U T P U T $ { t r a n s _ i n f i l e }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { t r a n s _ s r c f i l e } $ { t r a n s _ i n f i l e }
M A I N _ D E P E N D E N C Y $ { t r a n s _ s r c f i l e }
)
configure_file ( ${ CMAKE_SOURCE_DIR } /lang/calamares_i18n.qrc.in ${ trans_infile } @ONLY )
qt5_add_translation ( QM_FILES ${ TS_FILES } )
# R u n t h e r e s o u r c e compiler ( rcc_options should already be set )
add_custom_command (
O U T P U T $ { t r a n s _ o u t f i l e }
C O M M A N D " $ { Q t 5 C o r e _ R C C _ E X E C U T A B L E } "
A R G S $ { r c c _ o p t i o n s } ${ _ r c c _ v e r s i o n _ s u p p o r t } - n a m e $ { t r a n s _ f i l e } - o $ { t r a n s _ o u t f i l e } $ { t r a n s _ i n f i l e }
A R G S $ { r c c _ o p t i o n s } -- f o r m a t - v e r s i o n 1 - n a m e $ { t r a n s _ f i l e } - o $ { t r a n s _ o u t f i l e } $ { t r a n s _ i n f i l e }
M A I N _ D E P E N D E N C Y $ { t r a n s _ i n f i l e }
D E P E N D S $ { Q M _ F I L E S }
)