mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Add a filter to process options and report deprecation warning.
This commit is contained in:
parent
5097e2ed9e
commit
67609b0965
@ -24,6 +24,8 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake/mo
|
||||
set(PACKAGE "netCDF" CACHE STRING "")
|
||||
|
||||
include(netcdf_functions_macros)
|
||||
include(deprecated)
|
||||
|
||||
|
||||
# Backport of built-in `PROJECT_IS_TOP_LEVEL` from CMake 3.21
|
||||
if (NOT DEFINED NETCDF_IS_TOP_LEVEL)
|
||||
@ -440,6 +442,8 @@ if(NOT NETCDF_ENABLE_HDF5 OR NOT NETCDF_ENABLE_NETCDF_4)
|
||||
set(NETCDF_ENABLE_HDF5 OFF CACHE BOOL "Use HDF5" FORCE)
|
||||
endif()
|
||||
option(NETCDF_ENABLE_HDF4 "Build netCDF-4 with HDF4 read capability(HDF4, HDF5 and Zlib required)." OFF)
|
||||
|
||||
|
||||
option(NETCDF_ENABLE_DAP "Enable DAP2 and DAP4 Client." ON)
|
||||
option(NETCDF_ENABLE_NCZARR "Enable NCZarr Client." ON)
|
||||
option(NETCDF_ENABLE_PNETCDF "Build with parallel I/O for CDF-1, 2, and 5 files using PnetCDF." OFF)
|
||||
@ -1706,7 +1710,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf.settings.in"
|
||||
file(READ "${CMAKE_CURRENT_BINARY_DIR}/libnetcdf.settings"
|
||||
LIBNETCDF_SETTINGS)
|
||||
message(STATUS ${LIBNETCDF_SETTINGS})
|
||||
|
||||
message(STATUS ${DEPR_OPT})
|
||||
# Install libnetcdf.settings file into same location
|
||||
# as the libraries.
|
||||
install(FILES "${netCDF_BINARY_DIR}/libnetcdf.settings"
|
||||
|
42
cmake/deprecated.cmake
Normal file
42
cmake/deprecated.cmake
Normal file
@ -0,0 +1,42 @@
|
||||
#######
|
||||
# Check for deprecated arguments, provide warning, and set the
|
||||
# corresponding option.
|
||||
#
|
||||
# This file is being added in support of https://github.com/Unidata/netcdf-c/pull/2895 and may eventually
|
||||
# no longer be necessary and removed in the future.
|
||||
#
|
||||
#######
|
||||
|
||||
set(DEPR_OPT "Warning! Deprecated Options used. Please migrate your build system as follows:" CACHE INTERNAL "" FORCE)
|
||||
|
||||
function(check_depr_opt arg)
|
||||
|
||||
if(DEFINED ${arg})
|
||||
#message(STATUS "arg: ${arg} - ${${arg}}")
|
||||
set(val ${${arg}})
|
||||
#MESSAGE("val: ${val}")
|
||||
message(WARNING "${arg} is deprecated and will be removed. Please use NETCDF_${arg} in the future")
|
||||
set(NETCDF_${arg} ${val} CACHE INTERNAL "" FORCE)
|
||||
#MESSAGE(STATUS "Setting NETCDF_${arg} to ${val}")
|
||||
#MESSAGE(STATUS "Result: NETCDF_${arg} is ${NETCDF_${arg}}")
|
||||
set(DEPR_OPT "${DEPR_OPT}\n\to ${arg} --> NETCDF_${arg}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
MESSAGE(STATUS "Checking for Deprecated Options")
|
||||
list(APPEND opts BUILD_UTILITIES ENABLE_BENCHMARKS ENABLE_BYTERANGE ENABLE_CDF5 ENABLE_CONVERSION_WARNINGS)
|
||||
list(APPEND opts ENABLE_DAP ENABLE_DAP2 ENABLE_DAP4 ENABLE_DISKLESS ENABLE_DOXYGEN ENABLE_ERANGE_FILL)
|
||||
list(APPEND opts ENABLE_EXAMPLES ENABLE_EXAMPLES_TESTS ENABLE_EXTREME_NUMBERS ENABLE_FFIO ENABLE_FILTER_BLOSC)
|
||||
list(APPEND opts ENABLEFILTER_BZ2 ENABLE_FILTER_SZIP ENABLE_FILTER_TESTING ENABLE_FILTER_ZSTD ENABLE_FSYNC)
|
||||
list(APPEND opts ENABLE_HDF4 ENABLE_HDF5 ENABLE_LARGE_FILE_SUPPORT ENABLE_LARGE_FILE_TESTS ENABLE_LIBXML2)
|
||||
list(APPEND opts ENABLE_LOGGING ENABLE_METADATA_PERF_TESTS ENABLE_MMAP ENABLE_NCZARR ENABLE_NCZARR_FILTERS)
|
||||
list(APPEND opts ENABLE_NCZARR_S3 ENABLE_NCZARR_ZIP ENABLE_NETCDF_4 ENABLE_PARALLEL4 ENABLE_PARALLEL_TESTS)
|
||||
list(APPEND opts ENABLE_PLUGINS ENABLE_PNETCDF ENABLE_QUANTIZE ENABLE_REMOTE_FUNCTIONALITY ENABLE_S3 ENABLE_S3_AWS)
|
||||
list(APPEND opts ENABLE_S3_INTERNAL ENABLE_STDIO ENABLE_STRICT_NULL_BYTE_HEADER_PADDING ENABLE_TESTS ENABLE_UNIT_TESTS)
|
||||
list(APPEND opts FIND_SHARED_LIBS LIB_NAME)
|
||||
|
||||
foreach(opt ${opts})
|
||||
MESSAGE(STATUS "Option: ${opt}")
|
||||
check_depr_opt(${opt})
|
||||
endforeach()
|
Loading…
Reference in New Issue
Block a user