annotate cmake/function/IrccdIndentMessage.cmake @ 763:4283dc118339

Irccd: style (transport_util)
author David Demelier <markand@malikania.fr>
date Mon, 13 Aug 2018 13:50:11 +0200
parents e9adad05580f
children 8c44bbcbbab9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
270
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 # IrccdIndentMessage.cmake -- CMake build system for irccd
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 #
628
27587ff92a64 Misc: update copyrights
David Demelier <markand@malikania.fr>
parents: 394
diff changeset
4 # Copyright (c) 2016-2018 David Demelier <markand@malikania.fr>
270
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 # Permission to use, copy, modify, and/or distribute this software for any
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 # purpose with or without fee is hereby granted, provided that the above
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 # copyright notice and this permission notice appear in all copies.
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
17 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
18
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
19 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
20 # irccd_indent_message
659
e9adad05580f CMake: style #782
David Demelier <markand@malikania.fr>
parents: 628
diff changeset
21 # --------------------
270
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
22 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 # irccd_indent_message(variable value padding)
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
24 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
25 # Indent a message and its value with the specified amount of spaces between
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 # variable and value.
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
27 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 # Example:
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
29 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 # irccd_indent_message("godmode: " "false", 20)
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
31 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 # Will output:
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
33 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
34 # godmode: false
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
35 #
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
36
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 function(irccd_indent_message var value padding)
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
38 string(LENGTH "${var}" length)
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
39
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
40 while (${length} LESS ${padding})
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
41 math(EXPR length "${length} + 1")
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
42 set(space "${space} ")
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
43 endwhile ()
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
44
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
45 message("${var}${space}${value}")
90909cf677b1 CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff changeset
46 endfunction()