From b11c527ccee3e7063b1e36712a2133443ffb46ee Mon Sep 17 00:00:00 2001
From: Markus Blatt <markus@dr-blatt.de>
Date: Wed, 4 Feb 2015 10:16:06 +0100
Subject: [PATCH] Create a function that checks whether to use CMake for a
 module.

It sets LOCAL_USE_CMAKE for the current module depending on USE_CMAKE
and whether there actually is CMake support for this module.
This will make it more easy to use the same check in all run_*
directives.
---
 bin/dunecontrol | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/bin/dunecontrol b/bin/dunecontrol
index ab16ba315..396d6713f 100755
--- a/bin/dunecontrol
+++ b/bin/dunecontrol
@@ -348,6 +348,21 @@ for command in $COMMANDS; do
   eval "run_$command () { run_default_$command; }"
 done
 
+#
+# Check whether we should use cmake for this particular value
+# and set LOCAL_USE_CMAKE accordingly.
+# We use cmake if USE_CMAKE is not set to no and the module has
+# CMake build infrastructure, i.e. a toplevel CMakeLists.txt
+#
+create_local_use_cmake() {
+  if test "x$USE_CMAKE" != "xno" && test -e "$(eval "echo \$PATH_$module")/CMakeLists.txt"; then
+    LOCAL_USE_CMAKE=yes
+  else
+    LOCAL_USE_CMAKE=no
+  fi
+}
+
+
 #
 # default implementations for commands...
 # these can be overwritten in the $CONTROL files
-- 
GitLab