From 2430ac5b7c06770eb3e746740f692002ed85e80f Mon Sep 17 00:00:00 2001
From: "Adam J. Stewart" <ajstewart426@gmail.com>
Date: Fri, 14 Aug 2020 01:59:34 -0500
Subject: [PATCH] GDAL: add spack external find support (#18004)

---
 var/spack/repos/builtin/packages/gdal/package.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py
index e5a727b66d..a24d7d07da 100644
--- a/var/spack/repos/builtin/packages/gdal/package.py
+++ b/var/spack/repos/builtin/packages/gdal/package.py
@@ -165,6 +165,12 @@ class Gdal(AutotoolsPackage):
 
     conflicts('+mdb', when='~java', msg='MDB driver requires Java')
 
+    executables = ['^gdal-config$']
+
+    @classmethod
+    def determine_version(cls, exe):
+        return Executable(exe)('--version', output=str, error=str).rstrip()
+
     def setup_build_environment(self, env):
         # Needed to install Python bindings to GDAL installation
         # prefix instead of Python installation prefix.
-- 
GitLab