grim/guifications2
Clone
Summary
Browse
Changes
Graph
updating ALL of the po files (it's been a really long time...)
cmake
2013-05-17, Gary Kramlich
a35a821ef420
updating ALL of the po files (it's been a really long time...)
include
(
CMakeParseArguments
)
find_package
(
Gettext
)
find_program
(
XGETTEXT_EXECUTABLE
xgettext
)
if
(
NOT
XGETTEXT_EXECUTABLE
)
message
(
FATAL_ERROR
"Failed to find xgettext"
)
endif
(
NOT
XGETTEXT_EXECUTABLE
)
set
(
DEFAULT_XGETTEXT_OPTIONS
--language=C
--keyword=_
--keyword=N_
--keyword=C_:1c,2
--keyword=NC_:1c,2
-s
--escape
--add-comments=
"/"
--package-name=
${
PROJECT_NAME
}
--package-version=
${
VERSION
}
)
function
(
gettextize_pot_file
_FIRST_ARG
)
set
(
options
)
set
(
oneValueArgs
FILENAME
)
set
(
multiValueArgs
SOURCES
BUILT_SOURCES
OPTIONS
)
cmake_parse_arguments
(
POT
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${
_FIRST_ARG
}
${
ARGN
}
)
if
(
POT_UNPARSED_ARGUMENTS
)
message
(
FATAL_ERROR
"Unknown keys given to pot_file(): \"
${
POT_UNPARSED_ARGUMENTS
}
\"")
endif(POT_UNPARSED_ARGUMENTS
)
if
(
NOT
POT_FILENAME
)
message
(
FATAL_ERROR
"No filename specified"
)
endif
(
NOT
POT_FILENAME
)
if
(
NOT
POT_SOURCES
)
message
(
FATAL_ERROR
"No sources specified"
)
endif
(
NOT
POT_SOURCES
)
if
(
NOT
POT_OPTIONS
)
set
(
POT_OPTIONS
${
DEFAULT_XGETTEXT_OPTIONS
}
)
endif
(
NOT
POT_OPTIONS
)
# now tweak the sources
if
(
POT_BUILT_SOURCES
)
foreach
(
ITEM
${
POT_BUILT_SOURCES
}
)
endforeach
(
ITEM
)
endif
(
POT_BUILT_SOURCES
)
add_custom_command
(
OUTPUT
${
POT_FILENAME
}
COMMAND
${
XGETTEXT_EXECUTABLE
}
${
POT_OPTIONS
}
-o
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
POT_FILENAME
}
${
POT_SOURCES
}
${
POT_BUILT_SOURCES
}
DEPENDS
${
POT_SOURCES
}
${
POT_BUILT_SOURCES
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
VERBATIM
)
add_custom_target
(
"${POT_FILENAME} potfile"
ALL
DEPENDS
${
POT_FILENAME
}
)
endfunction
(
gettextize_pot_file
)