Begin wiring in option to toggle automatic search for libxml2 in support of https://github.com/Unidata/netcdf-c/pulls/2135

This commit is contained in:
Ward Fisher 2021-11-02 15:35:04 -06:00
parent cf903a678a
commit eead7fa6d2
2 changed files with 25 additions and 17 deletions

View File

@ -9,7 +9,7 @@
#Minimum required CMake Version
cmake_minimum_required(VERSION 3.6.1)
#Project Name
#Project Name
project(netCDF LANGUAGES C CXX)
set(PACKAGE "netCDF" CACHE STRING "")
@ -26,7 +26,7 @@ set(PACKAGE "netCDF" CACHE STRING "")
SET(NC_VERSION_MAJOR 4)
SET(NC_VERSION_MINOR 8)
SET(NC_VERSION_PATCH 1)
SET(NC_VERSION_PATCH 2)
SET(NC_VERSION_NOTE "-development")
SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
SET(VERSION ${netCDF_VERSION})
@ -615,7 +615,7 @@ IF(USE_HDF5)
# .cmake files. If this is the case, they should
# specify HDF5_HL_LIBRARY, HDF5_LIBRARY, HDF5_INCLUDE_DIR manually.
#
# This script will attempt to determine the version of the HDF5 library programatically.
# This script will attempt to determine the version of the HDF5 library programatically.
##
IF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
SET(HDF5_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY})
@ -728,7 +728,7 @@ IF(USE_HDF5)
MESSAGE(FATAL_ERROR "netCDF requires at least HDF5 ${HDF5_VERSION_REQUIRED}. Found ${HDF5_VERSION}.")
ENDIF()
##
# Include the HDF5 include directory.
@ -769,13 +769,13 @@ IF(USE_HDF5)
ENDIF(${HDF5_VERSION} VERSION_GREATER "1.8.15")
ELSE(MSVC)
# Depending on the install, either HDF5_hdf_library or
# HDF5_C_LIBRARIES may be defined. We must check for either.
IF(HDF5_C_LIBRARIES AND NOT HDF5_hdf5_LIBRARY)
SET(HDF5_hdf5_LIBRARY ${HDF5_C_LIBRARIES})
ENDIF()
# Some versions of FIND_PACKAGE set HDF5_C_LIBRARIES, but not HDF5_C_LIBRARY
# We use HDF5_C_LIBRARY below, so need to make sure it is set.
IF(HDF5_C_LIBRARIES AND NOT HDF5_C_LIBRARY)
@ -937,7 +937,7 @@ int main() {
}" HAVE_LIBCURL_766)
IF (HAVE_LIBCURL_766)
# If libcurl version is >= 7.66, then can skip tests
# If libcurl version is >= 7.66, then can skip tests
# for these symbols which were added in an earlier version
set(HAVE_CURLOPT_USERNAME TRUE)
set(HAVE_CURLOPT_PASSWORD TRUE)
@ -1098,9 +1098,9 @@ IF(MSVC)
FILE(COPY ${netCDF_SOURCE_DIR}/libsrc/XGetopt.c
DESTINATION ${netCDF_BINARY_DIR}/ncdump/)
FILE(COPY ${netCDF_SOURCE_DIR}/libsrc/XGetopt.c
DESTINATION ${netCDF_BINARY_DIR}/nczarr_test/)
DESTINATION ${netCDF_BINARY_DIR}/nczarr_test/)
FILE(COPY ${netCDF_SOURCE_DIR}/libsrc/XGetopt.c
DESTINATION ${netCDF_BINARY_DIR}/ncdap_test/)
DESTINATION ${netCDF_BINARY_DIR}/ncdap_test/)
ENDIF()
ENDIF()
@ -1179,14 +1179,21 @@ IF(NOT FOUND_CURL)
ENDIF()
ENDIF(NOT FOUND_CURL)
OPTION(ENABLE_LIBXML2 "Link against libxml2 if it is available, use the packaged ezxml parser otherwise." ON)
SET(XMLPARSER "ezxml (bundled)")
# see if we have libxml2
find_package(LibXml2)
IF(LibXml2_FOUND)
SET(HAVE_LIBXML2 TRUE)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIRS})
ELSE()
SET(HAVE_LIBXML2 FALSE)
ENDIF()
IF(ENABLE_LIBXML2)
find_package(LibXml2)
IF(LibXml2_FOUND)
SET(HAVE_LIBXML2 TRUE)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIRS})
SET(XMLPARSER "libxml2")
ELSE()
SET(HAVE_LIBXML2 FALSE)
ENDIF()
ENDIF(ENABLE_LIBXML2)
IF(NOT ENABLE_BYTERANGE AND ENABLE_HDF5_ROS3)
MESSAGE(WARNING "ROS3 support requires ENABLE_BYTERANGE=TRUE; disabling ROS3 support")
@ -1730,7 +1737,7 @@ IF(ENABLE_ATEXIT_FINALIZE AND NOT HAVE_ATEXIT)
MESSAGE(WARNING "ENABLE_ATEXIT_FINALIZE set but atexit() function not defined")
ENDIF()
ENDIF()
# Check to see if MAP_ANONYMOUS is defined.
IF(MSVC)
MESSAGE(WARNING "mmap not supported under visual studio: disabling MMAP support.")

View File

@ -22,6 +22,7 @@ AM_LDFLAGS: @AM_LDFLAGS@
Shared Library: @enable_shared@
Static Library: @enable_static@
Extra libraries: @LIBS@
XML Parser: @XMLPARSER@
# Features
--------