aboutsummaryrefslogtreecommitdiff
path: root/gis/openorienteering-mapper/69977dfd4cbb8608aafa8ca8b5388d4983f5430a.patch
blob: 6545099e95f46c3a1ad7c7eb8285f7ba352dc13f (plain)
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
From 69977dfd4cbb8608aafa8ca8b5388d4983f5430a Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebastic@debian.org>
Date: Sat, 23 Oct 2021 17:08:31 +0200
Subject: [PATCH] Add support for proj.h, proj_api.h is removed in PROJ 8.

---
 cmake/FindPROJ4.cmake | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/cmake/FindPROJ4.cmake b/cmake/FindPROJ4.cmake
index 093deaa79..10dfc7afa 100644
--- a/cmake/FindPROJ4.cmake
+++ b/cmake/FindPROJ4.cmake
@@ -91,6 +91,21 @@ if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj_api.h")
     string(REGEX REPLACE "^.*PJ_VERSION [0-9][0-9]([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ4_H}")
     set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
     set(PROJ4_VERSION_COUNT 3)
+else()
+    find_path(PROJ4_INCLUDE_DIR NAMES proj.h ${_PROJ4_SEARCH} PATH_SUFFIXES include)
+    mark_as_advanced(PROJ4_INCLUDE_DIR)
+
+    if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj.h")
+        file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MAJOR REGEX "^#define PROJ_VERSION_MAJOR [0-9]+$")
+        file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MINOR REGEX "^#define PROJ_VERSION_MINOR [0-9]+$")
+        file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_PATCH REGEX "^#define PROJ_VERSION_PATCH [0-9]+$")
+
+        string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MAJOR "${PROJ_VERSION_MAJOR}")
+        string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MINOR "${PROJ_VERSION_MINOR}")
+        string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ_VERSION_PATCH}")
+        set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
+        set(PROJ4_VERSION_COUNT 3)
+    endif()
 endif()
 
 # Allow PROJ4_LIBRARY to be set manually, as the location of the proj library