summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
Diffstat (limited to 'po')
-rw-r--r--po/CMakeLists.txt60
1 files changed, 27 insertions, 33 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 033b32f..9122c8d 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -13,44 +13,38 @@ SET ( DOMAIN "tuxanci" )
# if it is unset, install all languages
# if it is empty, dont install any language
# if it is set to some value, install those
+# cmake cant differ between empty and unset enviroment variable, so installing
+# all linguas when linguas is emtpy
###############################################################################
-IF ( DEFINED $ENV{LINGUAS} )
- # no languages
- SET ( _po_files )
- IF ( $ENV{LINGUAS} )
- # only specified languages
- SET ( _install )
- FOREACH ( _lang $ENV{LINGUAS} )
- IF ( EXISTS ${CURRENT_SOURCE_DIR}/${_lang}.po )
- LIST ( APPEND _po_files ${CURRENT_SOURCE_DIR}/${_lang}.po )
- LIST ( APPEND _install ${_lang} )
- ENDIF ( EXISTS ${CURRENT_SOURCE_DIR}/${_lang}.po )
- ENDFOREACH ( _lang )
- IF ( ${_install} )
- MESSAGE ( "Installing translations: ${_install}" )
- ELSE ( ${_install} )
- MESSAGE ( "LINGUAS variable is set but no coresponding availible translations found. Installing none" )
- ENDIF ( ${_install} )
- ELSE ( $ENV{LINGUAS} )
- MESSAGE ( "LINGUAS variable is empty so no languages will be installed" )
- ENDIF ( $ENV{LINGUAS} )
-ELSE ( DEFINED $ENV{LINGUAS} )
+SET ( lingua "$ENV{LINGUAS}" )
+string(REGEX REPLACE "[ \t]+" \; output "${lingua}")
+SET ( lingua_list ${output} )
+IF ( ${lingua} STREQUAL "" )
# all languages
- MESSAGE ( "Installing all available languages." )
FILE ( GLOB _po_files *.po )
-ENDIF ( DEFINED $ENV{LINGUAS} )
+ELSE ( ${lingua} STREQUAL "" )
+ # only specified languages
+ SET ( _install )
+ SET ( _po_files )
+ FOREACH ( _lang ${lingua_list} )
+ FILE ( GLOB _po_file ${_lang}*.po )
+ LIST ( APPEND _po_files ${_po_file} )
+ ENDFOREACH ( _lang )
+ENDIF ( ${lingua} STREQUAL "" )
SET ( _gmoFiles )
FOREACH ( _current_PO_FILE ${_po_files} )
- GET_FILENAME_COMPONENT ( _lang ${_current_PO_FILE} NAME_WE )
- SET ( _gmoFile ${CMAKE_BINARY_DIR}/po/${_lang}.gmo )
- ADD_CUSTOM_COMMAND ( OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- DEPENDS ${_current_PO_FILE}
- )
- INSTALL ( FILES ${CMAKE_BINARY_DIR}/po/${_lang}.gmo
- DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES/ RENAME ${domain}.mo )
- LIST ( APPEND _gmoFiles ${_gmoFile} )
+ IF ( EXISTS ${_current_PO_FILE} )
+ GET_FILENAME_COMPONENT ( _lang ${_current_PO_FILE} NAME_WE )
+ SET ( _gmoFile ${CMAKE_BINARY_DIR}/po/${_lang}.gmo )
+ ADD_CUSTOM_COMMAND ( OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ DEPENDS ${_current_PO_FILE}
+ )
+ INSTALL ( FILES ${CMAKE_BINARY_DIR}/po/${_lang}.gmo
+ DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES/ RENAME ${domain}.mo )
+ LIST ( APPEND _gmoFiles ${_gmoFile} )
+ ENDIF ( EXISTS ${_current_PO_FILE} )
ENDFOREACH ( _current_PO_FILE )
ADD_CUSTOM_TARGET ( pofiles ALL DEPENDS ${_gmoFiles} )
###############################################################################