summaryrefslogtreecommitdiff
path: root/doc/CMakeLists.txt
blob: aa54a14c4231c5eaecce9d682f0147298610d410 (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
#
# Copyright (C) 2003-2023 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat.  If not, see <https://www.gnu.org/licenses/>.
#

if(ENABLE_MAN OR ENABLE_DOC)

  # docs languages
  set(AUTOGEN_LANG de en fr it ja pl sr)
  set(MAN_LANG cs de en fr it ja pl ru sr)
  set(USER_LANG de en fr it ja pl sr)
  set(PLUGIN_API_LANG en fr it ja sr)
  set(SCRIPTING_LANG de en fr it ja pl sr)
  set(FAQ_LANG de en es fr it ja pl sr)
  set(QUICKSTART_LANG cs de en es fr it ja pl ru sr)
  set(RELAY_LANG en fr ja sr)
  set(DEV_LANG en fr ja sr)

  find_package(Asciidoctor)
  if(ASCIIDOCTOR_FOUND)
    # common asciidoctor arguments
    set(ASCIIDOCTOR_ARGS
      -a experimental
      -a reproducible
      -a "prewrap!"
      -a "webfonts!"
      -a icons=font
      -a revnumber="${VERSION}"
      -a sectanchors
      -a source-highlighter=pygments
      -a pygments-style=native
      -a docinfodir="${CMAKE_CURRENT_SOURCE_DIR}"
      -a autogendir="${CMAKE_CURRENT_BINARY_DIR}/autogen"
    )

    # asciidoctor arguments for user's guide
    set(ASCIIDOCTOR_USER_ARGS
      -a toc=left
      -a toclevels=4
      -a sectnums
      -a sectnumlevels=3
      -a docinfo1
    )

    # asciidoctor arguments for plugin API reference
    set(ASCIIDOCTOR_PLUGIN_API_ARGS
      -a toc=left
      -a toclevels=4
      -a sectnums
      -a sectnumlevels=3
      -a docinfo1
    )

    # asciidoctor arguments for scripting guide
    set(ASCIIDOCTOR_SCRIPTING_ARGS
      -a toc=left
      -a toclevels=4
      -a sectnums
      -a sectnumlevels=3
      -a docinfo1
    )

    # asciidoctor arguments for FAQ
    set(ASCIIDOCTOR_FAQ_ARGS
      -a toc=left
      -a toclevels=2
      -a sectnums
      -a sectnumlevels=2
      -a docinfo1
    )

    # asciidoctor arguments for quickstart
    set(ASCIIDOCTOR_QUICKSTART_ARGS
      -a toc=left
      -a toclevels=1
      -a sectnums
      -a sectnumlevels=1
      -a docinfo1
    )

    # asciidoctor arguments for relay protocol
    set(ASCIIDOCTOR_RELAY_ARGS
      -a toc=left
      -a toclevels=3
      -a sectnums
      -a sectnumlevels=3
      -a docinfo1
    )

    # asciidoctor arguments for developer's guide
    set(ASCIIDOCTOR_DEV_ARGS
      -a toc=left
      -a toclevels=3
      -a sectnums
      -a sectnumlevels=3
      -a docinfo1
    )

    # sed arguments used to replace links in ChangeLog and release notes
    set(SED_LINKS_ARGS
      -e "'s/issue #\\([0-9][0-9]*\\)/https:\\/\\/github.com\\/weechat\\/weechat\\/issues\\/\\1[issue #\\1^]/g'"
      -e "'s/bug #\\([0-9][0-9]*\\)/https:\\/\\/savannah.nongnu.org\\/bugs\\/?\\1[bug #\\1^]/g'"
      -e "'s/task #\\([0-9][0-9]*\\)/https:\\/\\/savannah.nongnu.org\\/task\\/?\\1[task #\\1^]/g'"
      -e "'s/patch #\\([0-9][0-9]*\\)/https:\\/\\/savannah.nongnu.org\\/patch\\/?\\1[patch #\\1^]/g'"
      -e "'s/debian #\\([0-9][0-9]*\\)/http:\\/\\/bugs.debian.org\\/cgi-bin\\/bugreport.cgi?bug=\\1[debian bug #\\1^]/g'"
      -e "'s/\\(CVE-[0-9][0-9]*-[0-9][0-9]*\\)/https:\\/\\/cve.mitre.org\\/cgi-bin\\/cvename.cgi?name=\\1[\\1^]/g'"
    )

    # ChangeLog
    add_custom_command(
      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog-links.adoc"
      COMMAND sed ARGS ${SED_LINKS_ARGS} "${CMAKE_CURRENT_SOURCE_DIR}/../ChangeLog.adoc" > "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog-links.adoc"
      DEPENDS
      "${CMAKE_CURRENT_SOURCE_DIR}/../ChangeLog.adoc"
      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    )
    add_custom_command(
      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog.html"
      COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} -o ChangeLog.html "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog-links.adoc"
      DEPENDS
      "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
      "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog-links.adoc"
      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
      COMMENT "Building ChangeLog.html"
    )
    add_custom_target(changelog DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog.html")

    # Release notes
    add_custom_command(
      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes-links.adoc"
      COMMAND sed ARGS ${SED_LINKS_ARGS} "${CMAKE_CURRENT_SOURCE_DIR}/../ReleaseNotes.adoc" > "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes-links.adoc"
      DEPENDS
      "${CMAKE_CURRENT_SOURCE_DIR}/../ReleaseNotes.adoc"
      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    )
    add_custom_command(
      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes.html"
      COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} -o ReleaseNotes.html "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes-links.adoc"
      DEPENDS
      "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
      "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes-links.adoc"
      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
      COMMENT "Building ReleaseNotes.html"
    )
    add_custom_target(rn DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ReleaseNotes.html")

    if(ENABLE_DOC)
      set(AUTOGEN_FILES "")
      foreach(lang ${AUTOGEN_LANG})
        LIST(APPEND AUTOGEN_FILES
          # plugin API reference
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_completions.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_config_priority.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_hdata.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infolists.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infos.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infos_hashtable.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_plugins_priority.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_url_options.${lang}.adoc"
          # user's guide
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_commands.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_default_aliases.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_irc_colors.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_options.${lang}.adoc"
        )
      endforeach()
      add_custom_target(doc-autogen ALL
        COMMAND "${CMAKE_COMMAND}" -E env "WEECHAT_EXTRA_LIBDIR=${PROJECT_BINARY_DIR}/src" "WEECHAT_DOCGEN_LOCALEDIR=${PROJECT_BINARY_DIR}/po" "${CMAKE_BINARY_DIR}/src/gui/curses/headless/weechat-headless" --temp-dir --doc-gen "${CMAKE_CURRENT_BINARY_DIR}/autogen"
        DEPENDS
        # the headless binary is required
        weechat-headless
        # translations must be compiled
        translations
        # all plugins must be loaded during doc generation
        alias buflist charset exec fifo fset guile irc logger lua perl php python relay ruby script spell tcl trigger typing xfer
        BYPRODUCTS ${AUTOGEN_FILES}
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
      )
    endif()

    if(ENABLE_MAN)
      foreach(lang ${MAN_LANG})
        if(${lang} STREQUAL "en")
          set(MANDIR_LANG "${MANDIR}/man1")
        else()
          set(MANDIR_LANG "${MANDIR}/${lang}/man1")
        endif()
        # man page: weechat
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat.${lang}.1"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} -b manpage -o "weechat.${lang}.1" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat.1.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat.1.${lang}.adoc"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/includes/cmdline_options.${lang}.adoc"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/includes/man.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat.1 (${lang})"
        )
        add_custom_target(doc-man-weechat-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat.${lang}.1")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat.${lang}.1" DESTINATION "${MANDIR_LANG}" RENAME "weechat.1")
        # man page: weechat-headless
        if(ENABLE_HEADLESS)
          add_custom_command(
            OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.${lang}.1"
            COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} -b manpage -o "weechat-headless.${lang}.1" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat-headless.1.${lang}.adoc"
            DEPENDS
            "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat-headless.1.${lang}.adoc"
            "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/includes/cmdline_options.${lang}.adoc"
            "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/includes/man.${lang}.adoc"
            WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
            COMMENT "Building weechat-headless.1 (${lang})"
          )
          add_custom_target(doc-man-weechat-headless-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.${lang}.1")
          install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.${lang}.1" DESTINATION "${MANDIR_LANG}" RENAME "weechat-headless.1")
        endif()
      endforeach()
    endif()

    if(ENABLE_DOC)
      # user's guide
      foreach(lang ${USER_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_user.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_USER_ARGS} -o "weechat_user.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_user.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_user.${lang}.adoc"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/includes/cmdline_options.${lang}.adoc"
          doc-autogen
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_commands.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_default_aliases.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_irc_colors.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_user_options.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_user.${lang}.html"
        )
        add_custom_target(doc-user-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_user.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_user.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # plugin API reference
      foreach(lang ${PLUGIN_API_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_plugin_api.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_PLUGIN_API_ARGS} -o "weechat_plugin_api.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_plugin_api.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_plugin_api.${lang}.adoc"
          doc-autogen
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_completions.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_config_priority.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_hdata.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infolists.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infos.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_infos_hashtable.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_plugins_priority.${lang}.adoc"
          "${CMAKE_CURRENT_BINARY_DIR}/autogen/autogen_api_url_options.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_plugin_api.${lang}.html"
        )
        add_custom_target(doc-plugin-api-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_plugin_api.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_plugin_api.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # scripting guide
      foreach(lang ${SCRIPTING_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_scripting.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_SCRIPTING_ARGS} -o "weechat_scripting.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_scripting.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_scripting.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_scripting.${lang}.html"
        )
        add_custom_target(doc-scripting-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_scripting.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_scripting.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # FAQ
      foreach(lang ${FAQ_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_faq.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_FAQ_ARGS} -o "weechat_faq.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_faq.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_faq.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_faq.${lang}.html"
        )
        add_custom_target(doc-faq-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_faq.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_faq.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # quickstart
      foreach(lang ${QUICKSTART_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_quickstart.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_QUICKSTART_ARGS} -o "weechat_quickstart.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_quickstart.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_quickstart.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_quickstart.${lang}.html"
        )
        add_custom_target(doc-quickstart-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_quickstart.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_quickstart.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # relay protocol
      foreach(lang ${RELAY_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_RELAY_ARGS} -o "weechat_relay_protocol.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_relay_protocol.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_relay_protocol.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_relay_protocol.${lang}.html"
        )
        add_custom_target(doc-relay-protocol-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
      # developer's guide
      foreach(lang ${DEV_LANG})
        add_custom_command(
          OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/weechat_dev.${lang}.html"
          COMMAND "${ASCIIDOCTOR_EXECUTABLE}" ARGS ${ASCIIDOCTOR_ARGS} ${ASCIIDOCTOR_DEV_ARGS} -o "weechat_dev.${lang}.html" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_dev.${lang}.adoc"
          DEPENDS
          "${CMAKE_CURRENT_SOURCE_DIR}/docinfo.html"
          "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/weechat_dev.${lang}.adoc"
          WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
          COMMENT "Building weechat_dev.${lang}.html"
        )
        add_custom_target(doc-dev-${lang} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/weechat_dev.${lang}.html")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat_dev.${lang}.html" DESTINATION "${DATAROOTDIR}/doc/${PROJECT_NAME}")
      endforeach()
    endif()

  else()
    message(SEND_ERROR "Asciidoctor not found")
  endif()

endif()