Changing Gettext ABI automatically.
This commit is contained in:
parent
28caeab8ac
commit
a0b6683360
|
@ -0,0 +1,41 @@
|
|||
function(GETTEXT_PROCESS_PO_FILES _lang)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs PO_FILES)
|
||||
set(_gmoFiles)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
|
||||
get_filename_component(_name ${_current_PO_FILE} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
|
||||
set(_basenameMAJOR ${_basename}-${MAJOR})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basenameMAJOR}.gmo)
|
||||
add_custom_command(OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basenameMAJOR}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basenameMAJOR}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach()
|
||||
|
||||
|
||||
if(NOT TARGET pofiles)
|
||||
add_custom_target(pofiles)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
|
||||
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
|
||||
add_dependencies(pofiles ${uniqueTargetName})
|
||||
|
||||
endfunction()
|
|
@ -1,3 +1,4 @@
|
|||
INCLUDE (FindGettextOverride)
|
||||
FILE (GLOB _po_files *.po)
|
||||
GET_FILENAME_COMPONENT (LANG "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
GETTEXT_PROCESS_PO_FILES ("${LANG}" ALL INSTALL_DESTINATION ${LOCALEDIR} PO_FILES ${_po_files} )
|
||||
|
|
Loading…
Reference in New Issue