Mercurial > irccd
annotate cmake/IrccdDefinePlugin.cmake @ 1114:cda2076a7ece
misc: fix build without javascript
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 04 Nov 2021 14:50:10 +0100 |
parents | 6c15d37b7518 |
children | 75e228008e07 |
rev | line source |
---|---|
1098
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 # CMakeLists.txt -- CMake build system for irccd |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
4 # Copyright (c) 2013-2021 David Demelier <markand@malikania.fr> |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 # Permission to use, copy, modify, and/or distribute this software for any |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 # purpose with or without fee is hereby granted, provided that the above |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 # copyright notice and this permission notice appear in all copies. |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
19 function(irccd_define_native_plugin) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
20 set(options "") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 set(oneValueArgs "MAN;NAME") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
22 set(multiValueArgs "FLAGS;INCLUDES;LIBRARIES;SOURCES") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
23 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
24 cmake_parse_arguments(PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
25 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
26 if (NOT PLG_NAME) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
27 message(FATAL_ERROR "Missing NAME") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
28 elseif (NOT PLG_SOURCES) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
29 message(FATAL_ERROR "Missing SOURCES") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
30 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
31 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
32 add_library(irccd-plugin-${PLG_NAME} MODULE ${PLG_SOURCES} ${PLG_MAN}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
33 target_link_libraries(irccd-plugin-${PLG_NAME} irccd) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
34 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
35 if (PLG_FLAGS) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
36 target_compile_definitions(irccd-plugin-${PLG_NAME} ${PLG_FLAGS}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
37 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
38 if (PLG_INCLUDES) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
39 target_include_directories(irccd-plugin-${PLG_NAME} ${PLG_INCLUDES}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
40 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
41 if (PLG_LIBRARIES) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
42 target_link_libraries(irccd-plugin-${PLG_NAME} ${PLG_LIBRARIES}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
43 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
44 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
45 set_target_properties( |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
46 irccd-plugin-${PLG_NAME} |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
47 PROPERTIES |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
48 OUTPUT_NAME ${PLG_NAME} |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
49 PREFIX "" |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
50 FOLDER plugins |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
51 ) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
52 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
53 install( |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
54 TARGETS irccd-plugin-${PLG_NAME} |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
55 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/irccd |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
56 ) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
57 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
58 if (PLG_MAN) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
59 install( |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
60 FILES ${PLG_MAN} |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
61 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
62 RENAME irccd-plugin-${PLG_NAME}.7 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
63 ) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
64 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
65 endfunction() |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
66 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
67 function(irccd_define_javascript_plugin) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
68 set(options "") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
69 set(oneValueArgs "MAN;NAME") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
70 set(multiValueArgs "SCRIPT") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
71 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
72 cmake_parse_arguments(PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
73 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
74 add_custom_target(irccd-plugin-${PLG_NAME} SOURCES ${PLG_SCRIPT}) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
75 set_target_properties(irccd-plugin-${PLG_NAME} PROPERTIES FOLDER plugins) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
76 install(FILES ${PLG_SCRIPT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/irccd) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
77 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
78 if (PLG_MAN) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
79 install( |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
80 FILES ${PLG_MAN} |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
81 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
82 RENAME irccd-plugin-${PLG_NAME}.7 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
83 ) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
84 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
85 endfunction() |