|
Lines 1049-1054
macro( tde_create_translation )
Link Here
|
| 1049 |
unset( _srcs ) |
1049 |
unset( _srcs ) |
| 1050 |
unset( _lang ) |
1050 |
unset( _lang ) |
| 1051 |
unset( _dest ) |
1051 |
unset( _dest ) |
|
|
1052 |
unset( _out_name ) |
| 1052 |
unset( _directive ) |
1053 |
unset( _directive ) |
| 1053 |
unset( _var ) |
1054 |
unset( _var ) |
| 1054 |
|
1055 |
|
|
Lines 1075-1080
macro( tde_create_translation )
Link Here
|
| 1075 |
set( _directive 1 ) |
1076 |
set( _directive 1 ) |
| 1076 |
endif( ) |
1077 |
endif( ) |
| 1077 |
|
1078 |
|
|
|
1079 |
# found directive "DESTINATION" |
| 1080 |
if( "${_arg}" STREQUAL "OUTPUT_NAME" ) |
| 1081 |
unset( _proj ) |
| 1082 |
set( _var _out_name ) |
| 1083 |
set( _directive 1 ) |
| 1084 |
endif( ) |
| 1085 |
|
| 1078 |
# collect data |
1086 |
# collect data |
| 1079 |
if( _directive ) |
1087 |
if( _directive ) |
| 1080 |
unset( _directive ) |
1088 |
unset( _directive ) |
|
Lines 1088-1117
macro( tde_create_translation )
Link Here
|
| 1088 |
tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" ) |
1096 |
tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" ) |
| 1089 |
elseif( NOT _lang ) |
1097 |
elseif( NOT _lang ) |
| 1090 |
tde_message_fatal( "missing LANG directive" ) |
1098 |
tde_message_fatal( "missing LANG directive" ) |
| 1091 |
elseif( NOT _dest ) |
|
|
| 1092 |
set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" ) |
| 1093 |
endif( ) |
1099 |
endif( ) |
| 1094 |
|
1100 |
|
| 1095 |
# if no file specified, include all *.po files |
1101 |
# if no file specified, include all *.po files |
| 1096 |
if( NOT _srcs ) |
1102 |
if( NOT _srcs ) |
| 1097 |
file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) |
1103 |
file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) |
| 1098 |
endif() |
1104 |
endif( ) |
| 1099 |
if( NOT _srcs ) |
1105 |
if( NOT _srcs ) |
| 1100 |
tde_message_fatal( "no source files" ) |
1106 |
tde_message_fatal( "no source files" ) |
| 1101 |
endif() |
1107 |
endif( ) |
|
|
1108 |
|
| 1109 |
if( NOT _lang STREQUAL "auto") |
| 1110 |
set( _real_lang ${_lang} ) |
| 1111 |
|
| 1112 |
if( NOT _dest ) |
| 1113 |
set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" ) |
| 1114 |
endif( ) |
| 1115 |
|
| 1116 |
# OUTPUT_NAME can only be used if we have only one file |
| 1117 |
list( LENGTH _srcs _srcs_num) |
| 1118 |
if( _out_name AND _srcs_num GREATER 1 ) |
| 1119 |
tde_message_fatal( "OUTPUT_NAME can be supplied only with single file or LANG=auto" ) |
| 1120 |
endif( ) |
| 1121 |
|
| 1122 |
elseif( NOT _out_name ) |
| 1123 |
tde_message_fatal( "LANG=auto reqires OUTPUT_NAME directive to be set" ) |
| 1124 |
elseif( _dest ) |
| 1125 |
tde_message_fatal( "DESTINATION cannot be used with LANG=auto" ) |
| 1126 |
endif( ) |
| 1102 |
|
1127 |
|
| 1103 |
# generate *.mo files |
1128 |
# generate *.mo files |
| 1104 |
foreach( _src ${_srcs} ) |
1129 |
foreach( _src ${_srcs} ) |
|
|
1130 |
|
| 1105 |
get_filename_component( _src ${_src} ABSOLUTE ) |
1131 |
get_filename_component( _src ${_src} ABSOLUTE ) |
| 1106 |
get_filename_component( _out ${_src} NAME_WE ) |
1132 |
|
| 1107 |
set( _out_name "${_out}-${_lang}.mo" ) |
1133 |
if( _out_name ) |
| 1108 |
set( _out_real_name "${_out}.mo" ) |
1134 |
set( _out ${_out_name} ) |
|
|
1135 |
if( _lang STREQUAL "auto" ) |
| 1136 |
get_filename_component( _real_lang ${_src} NAME_WE ) |
| 1137 |
set( _dest "${LOCALE_INSTALL_DIR}/${_real_lang}/LC_MESSAGES" ) |
| 1138 |
endif( ) |
| 1139 |
else( ) |
| 1140 |
get_filename_component( _out ${_src} NAME_WE ) |
| 1141 |
endif( ) |
| 1142 |
|
| 1143 |
set( _out_filename "${_out}-${_real_lang}.mo" ) |
| 1144 |
set( _install_filename "${_out}.mo" ) |
| 1145 |
|
| 1109 |
add_custom_command( |
1146 |
add_custom_command( |
| 1110 |
OUTPUT ${_out_name} |
1147 |
OUTPUT ${_out_filename} |
| 1111 |
COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_name} |
1148 |
COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_filename} |
| 1112 |
DEPENDS ${_src} ) |
1149 |
DEPENDS ${_src} ) |
| 1113 |
add_custom_target( "${_out}-${_lang}-translation" ALL DEPENDS ${_out_name} ) |
1150 |
add_custom_target( "${_out}-${_real_lang}-translation" ALL DEPENDS ${_out_filename} ) |
| 1114 |
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} RENAME ${_out_real_name} DESTINATION ${_dest} ) |
1151 |
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_filename} RENAME ${_install_filename} DESTINATION ${_dest} ) |
|
|
1152 |
|
| 1115 |
endforeach( ) |
1153 |
endforeach( ) |
| 1116 |
|
1154 |
|
| 1117 |
endmacro( ) |
1155 |
endmacro( ) |