69977dfd4cbb8608aafa8ca8b5388d4983f5430a.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 69977dfd4cbb8608aafa8ca8b5388d4983f5430a Mon Sep 17 00:00:00 2001
  2. From: Bas Couwenberg <sebastic@debian.org>
  3. Date: Sat, 23 Oct 2021 17:08:31 +0200
  4. Subject: [PATCH] Add support for proj.h, proj_api.h is removed in PROJ 8.
  5. ---
  6. cmake/FindPROJ4.cmake | 15 +++++++++++++++
  7. 1 file changed, 15 insertions(+)
  8. diff --git a/cmake/FindPROJ4.cmake b/cmake/FindPROJ4.cmake
  9. index 093deaa79..10dfc7afa 100644
  10. --- a/cmake/FindPROJ4.cmake
  11. +++ b/cmake/FindPROJ4.cmake
  12. @@ -91,6 +91,21 @@ if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj_api.h")
  13. string(REGEX REPLACE "^.*PJ_VERSION [0-9][0-9]([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ4_H}")
  14. set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
  15. set(PROJ4_VERSION_COUNT 3)
  16. +else()
  17. + find_path(PROJ4_INCLUDE_DIR NAMES proj.h ${_PROJ4_SEARCH} PATH_SUFFIXES include)
  18. + mark_as_advanced(PROJ4_INCLUDE_DIR)
  19. +
  20. + if(PROJ4_INCLUDE_DIR AND EXISTS "${PROJ4_INCLUDE_DIR}/proj.h")
  21. + file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MAJOR REGEX "^#define PROJ_VERSION_MAJOR [0-9]+$")
  22. + file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_MINOR REGEX "^#define PROJ_VERSION_MINOR [0-9]+$")
  23. + file(STRINGS "${PROJ4_INCLUDE_DIR}/proj.h" PROJ_VERSION_PATCH REGEX "^#define PROJ_VERSION_PATCH [0-9]+$")
  24. +
  25. + string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MAJOR "${PROJ_VERSION_MAJOR}")
  26. + string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_MINOR "${PROJ_VERSION_MINOR}")
  27. + string(REGEX REPLACE "^.*PROJ_VERSION_[A-Z]+ ([0-9]).*$" "\\1" PROJ4_VERSION_PATCH "${PROJ_VERSION_PATCH}")
  28. + set(PROJ4_VERSION "${PROJ4_VERSION_MAJOR}.${PROJ4_VERSION_MINOR}.${PROJ4_VERSION_PATCH}")
  29. + set(PROJ4_VERSION_COUNT 3)
  30. + endif()
  31. endif()
  32. # Allow PROJ4_LIBRARY to be set manually, as the location of the proj library