File: dunecontrol-Skip-directories-without-CMake-config-fi.patch

package info (click to toggle)
dune-common 2.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,812 kB
  • sloc: cpp: 52,256; python: 3,979; sh: 1,658; makefile: 17
file content (59 lines) | stat: -rw-r--r-- 2,101 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 9e8e88a6ed29d00a3e9b5cbf01114544fcc8c20e Mon Sep 17 00:00:00 2001
From: Markus Blatt <markus@dr-blatt.de>
Date: Wed, 20 Nov 2024 11:39:10 +0100
Subject: [PATCH] [dunecontrol] Skip directories without CMake config files for
 module_DIR

find_package(module) will fail if the directory set with module_DIR
does not contain CMake configuration file.

Hence the current approach requires that there are pkgconfig files
installed and found for each module to be used.

With this change we fall back to installed modules if the directory
does not contain any Cmake configuration files.

This fixes problems with using OPM as DUNE modules (in Debian) which
stopped shipping broken pkgconf file 2023-09
---
 bin/dunecontrol | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/bin/dunecontrol b/bin/dunecontrol
index 5b343338e..35b6838fb 100755
--- a/bin/dunecontrol
+++ b/bin/dunecontrol
@@ -656,17 +656,20 @@ run_default_cmake () {
       name=$(eval "echo \$NAME_$m")
       local m_ABS_BUILDDIR=$(abs_builddir $m $BUILDDIR)
 
+      config_dir="$path"
+      for i in $MULTIARCH_LIBDIR lib lib64 lib32; do
+        if test -d "$path/$i/cmake/$name"; then
+          config_dir="$path/$i/cmake/$name"
+          break;
+        fi
+      done
       if test -d "$m_ABS_BUILDDIR"; then
-        CMAKE_PARAMS="$CMAKE_PARAMS \"-D""$name""_DIR=$m_ABS_BUILDDIR\""
-      else
-        TMP_PARAMS="\"-D""$name""_DIR=$path\""
-        for i in $MULTIARCH_LIBDIR lib lib64 lib32; do
-          if test -d "$path/$i/cmake/$name"; then
-            TMP_PARAMS="\"-D""$name""_DIR=$path/$i/cmake/$name\""
-            break;
-          fi
-        done
-        CMAKE_PARAMS="$CMAKE_PARAMS $TMP_PARAMS"
+        config_dir="$m_ABS_BUILDDIR"
+      fi
+      # Only add directories with CMake config files to -Dmodule_DIR
+      # Then there is at least a chance to find packages in default locations
+      if ls "$config_dir"/*onfig.cmake 1> /dev/null 2>&1; then
+        CMAKE_PARAMS="$CMAKE_PARAMS \"-D""$name""_DIR=$config_dir\""
       fi
     fi
   done
-- 
2.39.5