Mercurial > irccd
annotate cmake/function/IrccdIndentMessage.cmake @ 824:06cc2f95f479
misc: happy new year!
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 08 Jan 2019 20:41:20 +0100 |
parents | 8c44bbcbbab9 |
children | 5e25439fe98d |
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 # |
824
06cc2f95f479
misc: happy new year!
David Demelier <markand@malikania.fr>
parents:
773
diff
changeset
|
4 # Copyright (c) 2016-2019 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 | 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) |
773
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
38 string(LENGTH "${var}" length) |
270
90909cf677b1
CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
39 |
773
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
40 while (${length} LESS ${padding}) |
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
41 math(EXPR length "${length} + 1") |
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
42 set(space "${space} ") |
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
43 endwhile () |
270
90909cf677b1
CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
44 |
773
8c44bbcbbab9
Misc: style, cleanup and update
David Demelier <markand@malikania.fr>
parents:
659
diff
changeset
|
45 message("${var}${space}${value}") |
270
90909cf677b1
CMake: make installation of DLLs more generic
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
46 endfunction() |