improve the HDF4 version handling at configuration level.
Build and Deploy Documentation / build-and-deploy (push) Successful in 22s

This commit is contained in:
suter_a committed 2026-09-17 08:45:33 +02:00
1 parent cd762a2808
commit 47f24cb844
1 file changed
+8 -1
+8 -1
View File
@@ -350,8 +350,15 @@ if (nexus)
endif()
#--- try to extract the HDF4 version from H4config.h (autotools builds) --------
# Some distributions (e.g. Debian/Ubuntu's libhdf4-dev) install it lower-cased
# as 'h4config.h' instead of the upstream 'H4config.h', so check both.
if (EXISTS "${HDF4_INCLUDE_DIR}/H4config.h")
file(STRINGS "${HDF4_INCLUDE_DIR}/H4config.h" HDF4_VERSION_LINE REGEX "^#define[ \t]+H4_VERSION[ \t]+\"[^\"]*\"")
set(HDF4_CONFIG_HEADER "${HDF4_INCLUDE_DIR}/H4config.h")
elseif (EXISTS "${HDF4_INCLUDE_DIR}/h4config.h")
set(HDF4_CONFIG_HEADER "${HDF4_INCLUDE_DIR}/h4config.h")
endif ()
if (HDF4_CONFIG_HEADER)
file(STRINGS "${HDF4_CONFIG_HEADER}" HDF4_VERSION_LINE REGEX "^#define[ \t]+H4_VERSION[ \t]+\"[^\"]*\"")
string(REGEX REPLACE "^#define[ \t]+H4_VERSION[ \t]+\"([^\"]*)\".*" "\\1" HDF4_VERSION "${HDF4_VERSION_LINE}")
endif ()