2 ${CMAKE_CURRENT_SOURCE_DIR}/english.txt
7 ${CMAKE_CURRENT_SOURCE_DIR}/afrikaans.txt
8 ${CMAKE_CURRENT_SOURCE_DIR}/arabic_egypt.txt
9 ${CMAKE_CURRENT_SOURCE_DIR}/basque.txt
10 ${CMAKE_CURRENT_SOURCE_DIR}/belarusian.txt
11 ${CMAKE_CURRENT_SOURCE_DIR}/brazilian_portuguese.txt
12 ${CMAKE_CURRENT_SOURCE_DIR}/bulgarian.txt
13 ${CMAKE_CURRENT_SOURCE_DIR}/catalan.txt
14 ${CMAKE_CURRENT_SOURCE_DIR}/chuvash.txt
15 ${CMAKE_CURRENT_SOURCE_DIR}/croatian.txt
16 ${CMAKE_CURRENT_SOURCE_DIR}/czech.txt
17 ${CMAKE_CURRENT_SOURCE_DIR}/danish.txt
18 ${CMAKE_CURRENT_SOURCE_DIR}/dutch.txt
19 ${CMAKE_CURRENT_SOURCE_DIR}/english_AU.txt
20 ${CMAKE_CURRENT_SOURCE_DIR}/english_US.txt
21 ${CMAKE_CURRENT_SOURCE_DIR}/esperanto.txt
22 ${CMAKE_CURRENT_SOURCE_DIR}/estonian.txt
23 ${CMAKE_CURRENT_SOURCE_DIR}/faroese.txt
24 ${CMAKE_CURRENT_SOURCE_DIR}/finnish.txt
25 ${CMAKE_CURRENT_SOURCE_DIR}/french.txt
26 ${CMAKE_CURRENT_SOURCE_DIR}/frisian.txt
27 ${CMAKE_CURRENT_SOURCE_DIR}/gaelic.txt
28 ${CMAKE_CURRENT_SOURCE_DIR}/galician.txt
29 ${CMAKE_CURRENT_SOURCE_DIR}/german.txt
30 ${CMAKE_CURRENT_SOURCE_DIR}/greek.txt
31 ${CMAKE_CURRENT_SOURCE_DIR}/hebrew.txt
32 ${CMAKE_CURRENT_SOURCE_DIR}/hindi.txt
33 ${CMAKE_CURRENT_SOURCE_DIR}/hungarian.txt
34 ${CMAKE_CURRENT_SOURCE_DIR}/icelandic.txt
35 ${CMAKE_CURRENT_SOURCE_DIR}/ido.txt
36 ${CMAKE_CURRENT_SOURCE_DIR}/indonesian.txt
37 ${CMAKE_CURRENT_SOURCE_DIR}/irish.txt
38 ${CMAKE_CURRENT_SOURCE_DIR}/italian.txt
39 ${CMAKE_CURRENT_SOURCE_DIR}/japanese.txt
40 ${CMAKE_CURRENT_SOURCE_DIR}/korean.txt
41 ${CMAKE_CURRENT_SOURCE_DIR}/latin.txt
42 ${CMAKE_CURRENT_SOURCE_DIR}/latvian.txt
43 ${CMAKE_CURRENT_SOURCE_DIR}/lithuanian.txt
44 ${CMAKE_CURRENT_SOURCE_DIR}/luxembourgish.txt
45 ${CMAKE_CURRENT_SOURCE_DIR}/macedonian.txt
46 ${CMAKE_CURRENT_SOURCE_DIR}/malay.txt
47 ${CMAKE_CURRENT_SOURCE_DIR}/maltese.txt
48 ${CMAKE_CURRENT_SOURCE_DIR}/marathi.txt
49 ${CMAKE_CURRENT_SOURCE_DIR}/norwegian_bokmal.txt
50 ${CMAKE_CURRENT_SOURCE_DIR}/norwegian_nynorsk.txt
51 ${CMAKE_CURRENT_SOURCE_DIR}/persian.txt
52 ${CMAKE_CURRENT_SOURCE_DIR}/polish.txt
53 ${CMAKE_CURRENT_SOURCE_DIR}/portuguese.txt
54 ${CMAKE_CURRENT_SOURCE_DIR}/romanian.txt
55 ${CMAKE_CURRENT_SOURCE_DIR}/russian.txt
56 ${CMAKE_CURRENT_SOURCE_DIR}/serbian.txt
57 ${CMAKE_CURRENT_SOURCE_DIR}/simplified_chinese.txt
58 ${CMAKE_CURRENT_SOURCE_DIR}/slovak.txt
59 ${CMAKE_CURRENT_SOURCE_DIR}/slovenian.txt
60 ${CMAKE_CURRENT_SOURCE_DIR}/spanish.txt
61 ${CMAKE_CURRENT_SOURCE_DIR}/spanish_MX.txt
62 ${CMAKE_CURRENT_SOURCE_DIR}/swedish.txt
63 ${CMAKE_CURRENT_SOURCE_DIR}/tamil.txt
64 ${CMAKE_CURRENT_SOURCE_DIR}/thai.txt
65 ${CMAKE_CURRENT_SOURCE_DIR}/traditional_chinese.txt
66 ${CMAKE_CURRENT_SOURCE_DIR}/turkish.txt
67 ${CMAKE_CURRENT_SOURCE_DIR}/urdu.txt
68 ${CMAKE_CURRENT_SOURCE_DIR}/ukrainian.txt
69 ${CMAKE_CURRENT_SOURCE_DIR}/vietnamese.txt
70 ${CMAKE_CURRENT_SOURCE_DIR}/welsh.txt
73 set(LANG_BINARY_DIR ${CMAKE_BINARY_DIR}/lang)
76 include(${HOST_BINARY_DIR}/strgen.cmake)
79 # Walk over all the (finished) language files, and generate a command to compile them
80 foreach(LANG_SOURCE_FILE IN LISTS LANG_SOURCE_FILES)
81 get_filename_component(LANG_SOURCE_FILE_NAME_WE ${LANG_SOURCE_FILE} NAME_WE)
83 set(LANG_BINARY_FILE ${LANG_BINARY_DIR}/${LANG_SOURCE_FILE_NAME_WE}.lng)
85 add_custom_command(OUTPUT ${LANG_BINARY_FILE}
86 COMMAND ${CMAKE_COMMAND} -E make_directory ${LANG_BINARY_DIR}
88 -s ${CMAKE_CURRENT_SOURCE_DIR}
91 DEPENDS strgen ${MASTER_LANG_FILE}
92 MAIN_DEPENDENCY ${LANG_SOURCE_FILE}
93 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
94 COMMENT "Compiling language ${LANG_SOURCE_FILE_NAME_WE}"
97 list(APPEND LANG_BINARY_FILES ${LANG_BINARY_FILE})
100 # Create a new target which compiles all language files
101 add_custom_target(language_files
105 set_target_properties(language_files
106 PROPERTIES LANG_SOURCE_FILES "${LANG_SOURCE_FILES}"
110 set(GENERATED_BINARY_DIR ${CMAKE_BINARY_DIR}/generated)
111 set(TABLE_BINARY_DIR ${GENERATED_BINARY_DIR}/table)
113 # Generate a command and target to create the strings table
114 add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/strings.h
115 COMMAND ${CMAKE_COMMAND} -E make_directory ${TABLE_BINARY_DIR}
117 -s ${CMAKE_CURRENT_SOURCE_DIR}
118 -d ${TABLE_BINARY_DIR}
119 DEPENDS strgen ${MASTER_LANG_FILE}
120 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
121 COMMENT "Generating table/strings.h"
123 add_custom_target_timestamp(table_strings
125 ${TABLE_BINARY_DIR}/strings.h
128 add_library(languages
131 target_include_directories(languages
133 ${GENERATED_BINARY_DIR}
135 add_dependencies(languages
139 add_library(openttd::languages ALIAS languages)