CMakeLists.txt   CMakeLists.txt 
skipping to change at line 24 skipping to change at line 24
# #
# translations-<DOMAIN> # translations-<DOMAIN>
# generate-pot-<DOMAIN> # generate-pot-<DOMAIN>
# update-po-<DOMAIN> # update-po-<DOMAIN>
# Same as above, but only affect the files in the corresponding # Same as above, but only affect the files in the corresponding
# po/<DOMAIN> directory. (DOMAIN is actually the base name of the POT # po/<DOMAIN> directory. (DOMAIN is actually the base name of the POT
# file in the subdirectory, but that should match the directory name # file in the subdirectory, but that should match the directory name
# anyway.) # anyway.)
ADD_CUSTOM_TARGET(translations) ADD_CUSTOM_TARGET(translations)
ADD_CUSTOM_TARGET(generate-pot)
ADD_CUSTOM_TARGET(update-po) IF(NOT MSVC)
# These packages are now used only to generate .pot and .po files
FIND_PACKAGE(Gettext)
FIND_PACKAGE(XGettext)
IF(${XGETTEXT_FOUND})
ADD_CUSTOM_TARGET(generate-pot)
ENDIF()
IF(${GETTEXT_FOUND})
ADD_CUSTOM_TARGET(update-po)
ENDIF()
ENDIF()
FIND_PACKAGE(Qt5LinguistTools REQUIRED)
GET_TARGET_PROPERTY(lupdate_executable Qt5::lupdate IMPORTED_LOCATION)
GET_FILENAME_COMPONENT(qtbindirectory ${lupdate_executable} PATH)
SET(lconvert_executable "${qtbindirectory}/lconvert")
# Creates translations directory if it doesn't exist
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/translations)
# GETTEXT_CREATE_TRANSLATIONS(domain [DEFAULT_TARGET] lang1 ... langN) # GETTEXT_CREATE_TRANSLATIONS(domain [DEFAULT_TARGET] lang1 ... langN)
# #
# Creates custom build rules to create and install (G)MO files for the # Creates custom build rules to create and install (G)MO files for the
# specified languages. If the DEFAULT_TARGET option is used, the # specified languages. If the DEFAULT_TARGET option is used, the
# translations will also be created when building the default target. # translations will also be created when building the default target.
# #
# "domain" is the translation domain, eg. "stellarium". A POT file # "domain" is the translation domain, eg. "stellarium". A POT file
# with the name ${domain}.pot must exist in the directory of the # with the name ${domain}.pot must exist in the directory of the
# CMakeLists.txt file invoking the macro. # CMakeLists.txt file invoking the macro.
# #
# This macro also creates the "translations-${domain}" and # This macro also creates the "translations-${domain}" and
# "update-po-${domain}" targets (see above for an explanation). # "update-po-${domain}" targets (see above for an explanation).
# #
MACRO(GETTEXT_CREATE_TRANSLATIONS _domain _firstLang) MACRO(GETTEXT_CREATE_TRANSLATIONS _domain _firstLang)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/translations/${_domain})
SET(_gmoFiles) SET(_gmoFiles)
GET_FILENAME_COMPONENT(_absPotFile ${_domain}.pot ABSOLUTE) GET_FILENAME_COMPONENT(_absPotFile ${_domain}.pot ABSOLUTE)
# Update these PO files when building the "update-po-<DOMAIN>" and IF(${GETTEXT_FOUND})
# "update-po" targets. # Update these PO files when building the "update-po-<DOMAIN>" and
ADD_CUSTOM_TARGET(update-po-${_domain}) # "update-po" targets.
ADD_DEPENDENCIES(update-po update-po-${_domain}) ADD_CUSTOM_TARGET(update-po-${_domain})
ADD_DEPENDENCIES(update-po update-po-${_domain})
# Make sure the POT file is updated before updating the PO files.
ADD_DEPENDENCIES(update-po-${_domain} generate-pot-${_domain}) # Make sure the POT file is updated before updating the PO files.
ADD_DEPENDENCIES(update-po-${_domain} generate-pot-${_domain})
ENDIF()
SET(_addToAll) SET(_addToAll)
IF(${_firstLang} STREQUAL "DEFAULT_TARGET") IF(${_firstLang} STREQUAL "DEFAULT_TARGET")
SET(_addToAll "ALL") SET(_addToAll "ALL")
SET(_firstLang) SET(_firstLang)
ENDIF(${_firstLang} STREQUAL "DEFAULT_TARGET") ENDIF(${_firstLang} STREQUAL "DEFAULT_TARGET")
FOREACH (_lang ${ARGN}) FOREACH (_lang ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_lang}.po ABSOLUTE) GET_FILENAME_COMPONENT(_absFile ${_lang}.po ABSOLUTE)
FILE(RELATIVE_PATH _relFile ${PROJECT_SOURCE_DIR} ${_absFile}) FILE(RELATIVE_PATH _relFile ${PROJECT_SOURCE_DIR} ${_absFile})
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) SET(_gmoFile ${CMAKE_BINARY_DIR}/translations/${_domain}/${_lang}.q m)
# Convert a PO file into a GMO file. # Convert a PO file into a qm file.
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${_gmoFile} OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} COMMAND ${lconvert_executable} -i ${_absFile} -o ${_gmoFile}
DEPENDS ${_absFile} DEPENDS ${_absFile}
) )
# Update the PO file unconditionally when building the IF(${GETTEXT_MSGMERGE_EXECUTABLE})
# "update-po-<DOMAIN>" target. Note that to see the file being # Update the PO file unconditionally when building t
# processed, we have to run "cmake -E echo", because the he
# COMMENT is not displayed by cmake... # "update-po-<DOMAIN>" target. Note that to see the
ADD_CUSTOM_COMMAND( file being
TARGET update-po-${_domain} # processed, we have to run "cmake -E echo", because
POST_BUILD the
COMMAND ${CMAKE_COMMAND} -E echo "** Updating ${_relFile}" # COMMENT is not displayed by cmake...
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} ADD_CUSTOM_COMMAND(
--quiet --update -m --backup=none -s TARGET update-po-${_domain}
${_absFile} ${_absPotFile} POST_BUILD
VERBATIM COMMAND ${CMAKE_COMMAND} -E echo "** Updatin
) g ${_relFile}"
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
--quiet --update -m --backup=none -s
${_absFile} ${_absPotFile}
VERBATIM
)
ENDIF()
INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESS AGES RENAME ${_domain}.mo) INSTALL(FILES ${_gmoFile} DESTINATION share/${PACKAGE}/translations /${_domain}/)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDFOREACH (_lang) ENDFOREACH (_lang)
# Create the GMO files when building the "translations-<DOMAIN>" and # Create the .qm files when building the "translations-<DOMAIN>" and
# "translations" targets. # "translations" targets.
ADD_CUSTOM_TARGET(translations-${_domain} ${_addToAll} DEPENDS ${_gmoFil es}) ADD_CUSTOM_TARGET(translations-${_domain} ${_addToAll} DEPENDS ${_gmoFil es})
ADD_DEPENDENCIES(translations translations-${_domain}) ADD_DEPENDENCIES(translations translations-${_domain})
ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
ADD_SUBDIRECTORY(stellarium) ADD_SUBDIRECTORY(stellarium)
ADD_SUBDIRECTORY(stellarium-skycultures) ADD_SUBDIRECTORY(stellarium-skycultures)
 End of changes. 9 change blocks. 
27 lines changed or deleted 57 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/