From aba646d3e462cc59dec67f98e6845274c9a91282 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Milk?= <rene.milk@wwu.de>
Date: Fri, 9 Mar 2018 11:24:02 +0100
Subject: [PATCH] [cmake] add macro to automatic bindings dependency building

Adding this macro in your source tree with a list of module names
will give you a 'dependent_bindings' target to build and if you don't
set ```-DDXT_NO_AUTO_BINDINGS_DEPENDS=TRUE``` this is added as a
dependency for the local 'bindings' target
---
 cmake/modules/DunePybindxiUtils.cmake | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/cmake/modules/DunePybindxiUtils.cmake b/cmake/modules/DunePybindxiUtils.cmake
index 82f31374c..eb92605e0 100644
--- a/cmake/modules/DunePybindxiUtils.cmake
+++ b/cmake/modules/DunePybindxiUtils.cmake
@@ -179,3 +179,21 @@ function(dune_pybindxi_add_module target_name)
     endif()
   endif()
 endfunction()
+
+macro(dxt_add_make_dependent_bindings)
+    add_custom_target(dependent_bindings)
+    if(TARGET bindings AND NOT DXT_NO_AUTO_BINDINGS_DEPENDS)
+      add_dependencies(bindings dependent_bindings)
+    endif()
+    foreach(_mod ${ARGN} )
+      dune_module_path(MODULE ${_mod}
+                     RESULT ${_mod}_binary_dir
+                     BUILD_DIR)
+      set(tdir ${${_mod}_binary_dir})
+      if(IS_DIRECTORY ${tdir})
+        add_custom_target( ${_mod}_bindings
+                            COMMAND ${CMAKE_COMMAND} --build ${tdir} --target bindings)
+        add_dependencies(dependent_bindings ${_mod}_bindings)
+      endif()
+    endforeach()
+endmacro()
-- 
GitLab