aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-12-11 14:14:17 +0100
committerAlex Neundorf <neundorf@kde.org>2011-12-11 14:14:17 +0100
commit5908cadf3dff5e0a67cbe2c864fae0d0caca6e58 (patch)
tree11f245c491c316ef232c36a638ce34726218b10c
parentccc9151fb4dd859226fd34936af18e70d8c31d93 (diff)
downloadextra-cmake-modules-5908cadf3dff5e0a67cbe2c864fae0d0caca6e58.tar.gz
extra-cmake-modules-5908cadf3dff5e0a67cbe2c864fae0d0caca6e58.tar.bz2
-add module ecm_print_variables(var1 var2 ... varN)
Alex
-rw-r--r--modules/ECMPrintVariables.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/ECMPrintVariables.cmake b/modules/ECMPrintVariables.cmake
new file mode 100644
index 00000000..b447cc0b
--- /dev/null
+++ b/modules/ECMPrintVariables.cmake
@@ -0,0 +1,28 @@
+# - Convenience macro for printing the values of cmake variables, useful e.g. while debugging.
+# ECM_PRINT_VARIABLES(var1 var2 .. varN)
+#
+# This macro will print the name of each variable followed by its value.
+# Example:
+# ecm_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION THIS_ONE_DOES_NOT_EXIST)
+# Gives:
+# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST=""
+
+# Copyright 2011 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+
+function(ECM_PRINT_VARIABLES)
+ set(msg "")
+ foreach(var ${ARGN})
+ if(msg)
+ set(msg "${msg} ; ")
+ endif()
+ set(msg "${msg}${var}=\"${${var}}\"")
+ endforeach()
+ message(STATUS "${msg}")
+endfunction()