From 594b0cf97b81a78f26bf75607c0470456c23e518 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Milk?= <rene.milk@wwu.de>
Date: Wed, 7 Feb 2018 09:53:38 +0100
Subject: [PATCH] [cmake] handle existing bindings target in
 dune_pybindxi_add_module

---
 cmake/modules/DunePybindxiUtils.cmake | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/cmake/modules/DunePybindxiUtils.cmake b/cmake/modules/DunePybindxiUtils.cmake
index ed99f49da..82f31374c 100644
--- a/cmake/modules/DunePybindxiUtils.cmake
+++ b/cmake/modules/DunePybindxiUtils.cmake
@@ -169,9 +169,13 @@ function(dune_pybindxi_add_module target_name)
   endif()
 
   add_dune_all_flags(${target_name})
-  if(DUNE_XT_WITH_PYTHON_BINDINGS)
-    add_custom_target(bindings ALL DEPENDS ${target_name})
+  if(TARGET bindings)
+    add_dependencies(bindings ${target_name})
   else()
-    add_custom_target(bindings DEPENDS ${target_name})
+    if(DUNE_XT_WITH_PYTHON_BINDINGS)
+      add_custom_target(bindings ALL DEPENDS ${target_name})
+    else()
+      add_custom_target(bindings DEPENDS ${target_name})
+    endif()
   endif()
 endfunction()
-- 
GitLab