diff cmake/function/IrccdIndentMessage.cmake @ 270:90909cf677b1

CMake: make installation of DLLs more generic
author David Demelier <markand@malikania.fr>
date Mon, 19 Sep 2016 13:42:54 +0200
parents
children c6fbb6e0e06d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/function/IrccdIndentMessage.cmake	Mon Sep 19 13:42:54 2016 +0200
@@ -0,0 +1,46 @@
+#
+# IrccdIndentMessage.cmake -- CMake build system for irccd
+#
+# Copyright (c) 2016 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+#
+# irccd_indent_message
+# -------------------------------------------------------------------
+#
+# irccd_indent_message(variable value padding)
+#
+# Indent a message and its value with the specified amount of spaces between
+# variable and value.
+#
+# Example:
+#
+# irccd_indent_message("godmode: " "false", 20)
+#
+# Will output:
+#
+# godmode:            false
+#
+
+function(irccd_indent_message var value padding)
+    string(LENGTH "${var}" length)
+
+    while (${length} LESS ${padding})
+        math(EXPR length "${length} + 1")
+        set(space "${space} ")
+    endwhile ()
+
+    message("${var}${space}${value}")
+endfunction()