comparison plugins/CMakeLists.txt @ 0:1158cffe5a5e

Initial import
author David Demelier <markand@malikania.fr>
date Mon, 08 Feb 2016 16:43:14 +0100
parents
children 78a9c59de053
comparison
equal deleted inserted replaced
-1:000000000000 0:1158cffe5a5e
1 #
2 # CMakeLists.txt -- CMake build system for irccd
3 #
4 # Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
5 #
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #
18
19 project(plugins)
20
21 add_custom_target(
22 plugins ALL
23 COMMENT "Irccd plugins"
24 )
25
26 foreach (plugin ${IRCCD_PLUGINS})
27 string(TOUPPER ${plugin} optname)
28
29 if (WITH_PLUGIN_${optname})
30 # 1. Configure the plugin and install it.
31 irccd_define_plugin(${plugin}/${plugin}.js)
32
33 # 2. Build documentation.
34 if (WITH_HTML)
35 if (IRCCD_RELOCATABLE)
36 set(basedocdir ${CMAKE_BINARY_DIR}/fakeroot/${WITH_DOCDIR})
37 else ()
38 set(basedocdir ${CMAKE_BINARY_DIR}/docs)
39 endif ()
40
41 file(RELATIVE_PATH baseurl ${basedocdir}/plugin ${basedocdir})
42
43 pandoc(
44 OUTPUT ${basedocdir}/plugin/${plugin}.html
45 SOURCES ${plugin}/${plugin}.md
46 TEMPLATE ${resources_SOURCE_DIR}/template.html
47 DEPENDS
48 ${resources_SOURCE_DIR}/template.html
49 docs-resources
50 ARGS -Vguide
51 VARIABLE baseurl:${baseurl}
52 FROM markdown TO html5
53 STANTALONE MAKE_DIRECTORY TOC
54 )
55
56 list(APPEND outputs ${basedocdir}/plugin/${plugin}.html)
57 install(FILES ${basedocdir}/plugin/${plugin}.html DESTINATION ${WITH_DOCDIR}/plugin)
58 endif ()
59
60 add_custom_target(
61 plugin-${plugin}
62 SOURCES
63 ${outputs}
64 ${plugin}/${plugin}.js
65 ${plugin}/${plugin}.md
66 )
67
68 add_dependencies(plugins plugin-${plugin})
69 endif ()
70 endforeach ()