/usr/share/cmake-3.5/Modules/UseXGettext.cmake is in cmake-extras 0.6+16.04.20160215-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | # Copyright (C) 2013 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Example usage:
#
# include(UseXGettext)
#
# add_translations_directory(${GETTEXT_PACKAGE})
#
# add_translations_catalog(
# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
# COPYRIGHT_HOLDER "Canonical Ltd."
# SOURCE_DIRECTORIES "${CMAKE_SOURCE_DIR}/src"
# )
cmake_minimum_required(VERSION 2.8.9)
find_package(XGettext REQUIRED)
macro(add_translations_directory GETTEXT_PACKAGE)
set(
_POT_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/${GETTEXT_PACKAGE}.pot"
)
file(
GLOB _PO_FILES
${CMAKE_CURRENT_SOURCE_DIR}/*.po
)
gettext_create_translations(
${_POT_FILE}
ALL
${_PO_FILES}
)
endmacro(add_translations_directory)
macro(add_translations_catalog)
set(_oneValueArgs GETTEXT_PACKAGE COPYRIGHT_HOLDER)
set(_multiValueArgs SOURCE_DIRECTORIES)
cmake_parse_arguments(_ARG "" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
set(_GETTEXT_PACKAGE ${PROJECT})
if(_ARG_GETTEXT_PACKAGE)
set(_GETTEXT_PACKAGE ${_ARG_GETTEXT_PACKAGE})
endif()
set(
_POT_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/${_GETTEXT_PACKAGE}.pot"
)
add_custom_target (pot
COMMENT “Building translation catalog.”
DEPENDS ${_POT_FILE}
)
set(_SOURCES "")
foreach(DIR ${_ARG_SOURCE_DIRECTORIES})
file(
GLOB_RECURSE _DIR_SOURCES
RELATIVE ${CMAKE_SOURCE_DIR}
${DIR}/*.cpp
${DIR}/*.cc
${DIR}/*.cxx
${DIR}/*.vala
${DIR}/*.c
${DIR}/*.h
)
set (_SOURCES ${_SOURCES} ${_DIR_SOURCES})
endforeach()
xgettext_create_pot_file(
${_POT_FILE}
ALL
CPP
QT
INPUT ${_SOURCES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
ADD_COMMENTS "TRANSLATORS"
KEYWORDS "_" "_:1,2" "N_" "N_:1,2"
PACKAGE_NAME ${_GETTEXT_PACKAGE}
COPYRIGHT_HOLDER ${_ARG_COPYRIGHT_HOLDER}
)
endmacro()
|