File: normalize_pot.cmake

package info (click to toggle)
leatherman 1.4.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,944 kB
  • sloc: cpp: 14,555; python: 3,105; sh: 45; makefile: 9; ruby: 1
file content (17 lines) | stat: -rw-r--r-- 648 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Normalizes a pot file generated by xgettext, so we can compare new files
# to see if they've changed. Normalization removes creation date, and sets
# the charset to UTF-8.
#
# Usage:
#   cmake -DPOT_FILE=<pot_file_name> \
#         -DSOURCE_DIR=<CMAKE_CURRENT_SOURCE_DIR> \
#         -P normalize_pot.cmake

file(READ ${POT_FILE} FILE_CONTENT)
string(REPLACE "charset=CHARSET" "charset=UTF-8"
    FILE_CONTENT "${FILE_CONTENT}")
string(REGEX REPLACE "POT-Creation-Date: [^\\]*" "POT-Creation-Date: "
    FILE_CONTENT "${FILE_CONTENT}")
string(REPLACE "${SOURCE_DIR}/" "" FILE_CONTENT "${FILE_CONTENT}")
file(WRITE ${POT_FILE} "${FILE_CONTENT}")