aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/netcdf-c
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/netcdf-c')
-rw-r--r--vcpkg/ports/netcdf-c/dependencies.diff246
-rw-r--r--vcpkg/ports/netcdf-c/fix-pkgconfig.patch45
-rw-r--r--vcpkg/ports/netcdf-c/mremap.diff13
-rw-r--r--vcpkg/ports/netcdf-c/no-install-deps.patch12
-rw-r--r--vcpkg/ports/netcdf-c/plugin-install-dir.diff14
-rw-r--r--vcpkg/ports/netcdf-c/portfile.cmake98
-rw-r--r--vcpkg/ports/netcdf-c/use_targets.patch130
-rw-r--r--vcpkg/ports/netcdf-c/vcpkg.json125
8 files changed, 683 insertions, 0 deletions
diff --git a/vcpkg/ports/netcdf-c/dependencies.diff b/vcpkg/ports/netcdf-c/dependencies.diff
new file mode 100644
index 0000000..e7ee97a
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/dependencies.diff
@@ -0,0 +1,246 @@
+diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
+index d06a276..5d97fd3 100644
+--- a/cmake/dependencies.cmake
++++ b/cmake/dependencies.cmake
+@@ -134,7 +134,22 @@ if(USE_HDF5)
+ #####
+ # First, find the C and HL libraries.
+ #####
+- find_package(HDF5 COMPONENTS C HL REQUIRED)
++ find_package(HDF5 NAMES hdf5 CONFIG COMPONENTS C HL REQUIRED)
++ if(TARGET HDF5::HDF5)
++ # pass
++ elseif(TARGET hdf5::hdf5-shared)
++ add_library(HDF5::HDF5 ALIAS hdf5::hdf5-shared)
++ elseif(TARGET hdf5::hdf5-static)
++ add_library(HDF5::HDF5 ALIAS hdf5::hdf5-static)
++ endif()
++ if(TARGET hdf5::hdf5_hl)
++ # pass
++ elseif(TARGET hdf5::hdf5_hl-shared)
++ add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-shared)
++ elseif(TARGET hdf5::hdf5_hl-static)
++ add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-static)
++ endif()
++ set(HDF5_IS_PARALLEL "${HDF5_ENABLE_PARALLEL}")
+
+ message(STATUS "Found HDF5 version: ${HDF5_VERSION}")
+ if(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED})
+@@ -144,7 +159,6 @@ if(USE_HDF5)
+ message(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIRS}")
+ target_link_libraries(netcdf
+ PRIVATE
+- HDF5::HDF5
+ )
+
+ find_package(Threads)
+@@ -244,10 +258,10 @@ if( NETCDF_ENABLE_DAP2 OR NETCDF_ENABLE_DAP4 OR NETCDF_ENABLE_BYTERANGE_SUPPORT
+ # ${CURL_INCLUDE_DIRS}
+ #)
+ if(CURL_FOUND)
++ set(CURL_LIBRARIES "")
+ set(FOUND_CURL TRUE)
+ target_link_libraries(netcdf
+ PRIVATE
+- CURL::libcurl
+ )
+ else()
+ set(FOUND_CURL FALSE)
+@@ -345,6 +359,10 @@ if(NOT WIN32)
+ set(HAVE_LIBM "")
+ endif()
+ else(NOT HAVE_LIBM)
++ find_library(HAVE_LIBM_M NAMES m)
++ if(HAVE_LIBM STREQUAL HAVE_LIBM_M)
++ set(HAVE_LIBM m)
++ endif()
+ message(STATUS "Found Math library: ${HAVE_LIBM}")
+ endif()
+ endif()
+@@ -354,6 +372,7 @@ endif()
+ ################################
+ # See if we have zlib
+ find_package(ZLIB)
++set(ZLIB_LIBRARY ZLIB::ZLIB)
+
+ # Define a test flag for have zlib library
+ if(ZLIB_FOUND)
+@@ -371,18 +390,25 @@ endif()
+ ################################
+ MESSAGE(STATUS "Checking for filter libraries")
+ IF (NETCDF_ENABLE_FILTER_SZIP)
+- find_package(Szip)
++ find_package(libaec CONFIG REQUIRED)
++ set(Szip_FOUND 1)
++ set(Szip_LIBRARY libaec::sz)
++ set(Szip_LIBRARIES "${Szip_LIBRARY}")
+ elseif(NETCDF_ENABLE_NCZARR)
+- find_package(Szip)
++ # purely transitive
+ endif()
+ IF (NETCDF_ENABLE_FILTER_BZ2)
+- find_package(Bz2)
++ find_package(BZip2 REQUIRED)
++ set(Bz2_FOUND 1)
++ set(Bz2_LIBRARIES BZip2::BZip2)
++ set(Bzip2_LIBRARIES "${Bz2_LIBRARIES}")
+ endif()
+ IF (NETCDF_ENABLE_FILTER_BLOSC)
+ find_package(Blosc)
+ endif()
+ IF (NETCDF_ENABLE_FILTER_ZSTD)
+- find_package(Zstd)
++ find_package(Zstd NAMES zstd REQUIRED)
++ set(Zstd_LIBRARIES zstd::libzstd)
+ endif()
+
+ # Accumulate standard filters
+@@ -412,7 +438,8 @@ endif()
+
+ set(STD_FILTERS "${STD_FILTERS}${FOUND_STD_FILTERS}")
+ IF (NETCDF_ENABLE_NCZARR_ZIP)
+- find_package(Zip)
++ find_package(Zip NAMES libzip REQUIRED)
++ set(Zip_LIBRARIES libzip::zip)
+ if(Zip_FOUND)
+ target_include_directories(netcdf
+ PRIVATE
+diff --git a/libdispatch/CMakeLists.txt b/libdispatch/CMakeLists.txt
+index 0f5d66d..13ef7ca 100644
+--- a/libdispatch/CMakeLists.txt
++++ b/libdispatch/CMakeLists.txt
+@@ -14,6 +14,10 @@ target_sources(dispatch
+ ncproplist.c
+ )
+
++if(NETCDF_ENABLE_DAP2 OR NETCDF_ENABLE_DAP4 OR NETCDF_ENABLE_BYTERANGE)
++ target_link_libraries(dispatch PRIVATE CURL::libcurl)
++endif()
++
+ if (NETCDF_ENABLE_DLL)
+ target_compile_definitions(dispatch PRIVATE DLL_NETCDF DLL_EXPORT)
+ endif()
+diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
+index cc482d5..5f263c5 100644
+--- a/liblib/CMakeLists.txt
++++ b/liblib/CMakeLists.txt
+@@ -43,7 +43,6 @@ if(USE_HDF4)
+ endif()
+
+ if(FOUND_CURL)
+- target_link_libraries(netcdf PRIVATE CURL::libcurl)
+ endif()
+
+ if(NETCDF_ENABLE_DAP2)
+@@ -60,6 +59,7 @@ if(NETCDF_ENABLE_DAP4)
+ $<TARGET_OBJECTS:dap4>
+ $<TARGET_OBJECTS:ncxml>
+ )
++ list(APPEND EXTRA_DEPS tinyxml2::tinyxml2)
+ endif()
+
+ if(NETCDF_ENABLE_NCZARR)
+@@ -74,6 +74,7 @@ if(NETCDF_ENABLE_S3_INTERNAL)
+ PRIVATE
+ $<TARGET_OBJECTS:ncxml>
+ )
++ list(APPEND EXTRA_DEPS tinyxml2::tinyxml2)
+ endif()
+
+ if(NETCDF_ENABLE_PLUGINS)
+@@ -185,6 +186,14 @@ endif()
+
+ if(TLL_LIBS)
+ list(REMOVE_DUPLICATES TLL_LIBS)
++ # Plugins only
++ list(REMOVE_ITEM TLL_LIBS
++ ${Blosc_LIBRARIES}
++ ${Bz2_LIBRARIES}
++ ${Szip_LIBRARIES}
++ ${ZLIB_LIBRARY}
++ ${Zstd_LIBRARIES}
++ )
+ endif()
+
+ target_link_libraries(netcdf PRIVATE ${TLL_LIBS})
+diff --git a/libncxml/CMakeLists.txt b/libncxml/CMakeLists.txt
+index b8fa4b2..65f1c18 100644
+--- a/libncxml/CMakeLists.txt
++++ b/libncxml/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ if(HAVE_LIBXML2)
+ set(libncxml_SOURCES ncxml_xml2.c)
+ else()
+- set(libncxml_SOURCES ncxml_tinyxml2.cpp tinyxml2.cpp tinyxml2.h)
++ set(libncxml_SOURCES ncxml_tinyxml2.cpp)
+ endif()
+
+ add_library(ncxml OBJECT ${libncxml_SOURCES})
+@@ -13,6 +13,8 @@ if(HAVE_LIBXML2)
+ ${LIBXML2_INCLUDE_DIRS}
+ )
+ else()
++ find_package(tinyxml2 CONFIG REQUIRED GLOBAL)
++ target_link_libraries(ncxml PRIVATE $<COMPILE_ONLY:tinyxml2::tinyxml2>)
+ target_include_directories(ncxml
+ PUBLIC
+ ./include
+diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in
+index 987b2ad..0dfda8e 100644
+--- a/netCDFConfig.cmake.in
++++ b/netCDFConfig.cmake.in
+@@ -4,6 +4,17 @@
+ #
+ @PACKAGE_INIT@
+
++if(NOT "@BUILD_SHARED_LIBS@")
++ include(CMakeFindDependencyMacro)
++ find_dependency(tinyxml2 CONFIG)
++ if("@FOUND_CURL@")
++ find_dependency(CURL)
++ endif()
++ if("@NETCDF_ENABLE_NCZARR_ZIP@")
++ find_dependency(libzip CONFIG)
++ endif()
++endif()
++
+ set(NetCDFVersion "@PACKAGE_VERSION@")
+ set_and_check(netCDF_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
+ set_and_check(netCDF_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")
+@@ -42,7 +53,7 @@ set(netCDF_HAS_DISKLESS @HAS_DISKLESS@)
+ set(netCDF_HAS_MMAP @HAS_MMAP@)
+ if (netCDF_HAS_HDF4 OR netCDF_HAS_HDF5)
+ include(CMakeFindDependencyMacro)
+- find_dependency(HDF5)
++ find_dependency(hdf5 CONFIG)
+ endif ()
+
+ if (@HAS_PARALLEL@)
+diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
+index fbaeb21..8cdb5d4 100644
+--- a/plugins/CMakeLists.txt
++++ b/plugins/CMakeLists.txt
+@@ -4,7 +4,7 @@
+ # University Corporation for Atmospheric Research/Unidata.
+
+ # See netcdf-c/COPYRIGHT file for more info.
+-set(CMAKE_BUILD_TYPE "")
++set(ALL_TLL_LIBS ${HAVE_LIBM})
+
+ if(WIN32)
+ set(PLUGINEXT "dll")
+@@ -86,10 +86,13 @@ buildplugin(h5unknown "h5unknown")
+
+ buildplugin(h5shuffle "h5shuffle")
+ buildplugin(h5fletcher32 "h5fletcher32")
+-buildplugin(h5deflate "h5deflate")
++buildplugin(h5deflate "h5deflate" ZLIB::ZLIB)
+
+ buildplugin(nczmisc "zmisc")
+ buildplugin(nczhdf5filters "zhdf5filters" netcdf)
++if(HAVE_SZ)
++ target_link_libraries(nczhdf5filters PRIVATE ${Szip_LIBRARIES})
++endif()
+
+ if(NETCDF_ENABLE_BLOSC)
+ set(h5blosc_SOURCES H5Zblosc.c)
diff --git a/vcpkg/ports/netcdf-c/fix-pkgconfig.patch b/vcpkg/ports/netcdf-c/fix-pkgconfig.patch
new file mode 100644
index 0000000..e5385dd
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/fix-pkgconfig.patch
@@ -0,0 +1,45 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bbb647c..a04ae6b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1628,6 +1628,20 @@ list(REMOVE_DUPLICATES LINKFLAGS)
+ set(LIBS ${NC_LIBS})
+ set(NC_LIBS "-lnetcdf")
+
++set(NC_LIBS_PRIVATE " ${LIBS} ")
++set(NC_REQUIRES_PRIVATE "")
++macro(replace_pkgconfig_module PATTERN MODULE)
++ if(NC_LIBS_PRIVATE MATCHES " ${PATTERN} ")
++ string(REPLACE "${CMAKE_MATCH_0}" " " NC_LIBS_PRIVATE "${NC_LIBS_PRIVATE}")
++ string(APPEND NC_REQUIRES_PRIVATE " ${MODULE}")
++ endif()
++endmacro()
++replace_pkgconfig_module("-lCURL[^ ]*" "libcurl")
++replace_pkgconfig_module("-lHDF5::HDF5" "hdf5")
++replace_pkgconfig_module("-lhdf5::hdf5_hl" "hdf5_hl")
++replace_pkgconfig_module("-ltinyxml2::tinyxml2" "tinyxml2")
++replace_pkgconfig_module("-lzip::zip" "libzip")
++
+ configure_file(
+ ${netCDF_SOURCE_DIR}/netcdf.pc.in
+ ${netCDF_BINARY_DIR}/netcdf.pc @ONLY)
+diff --git a/netcdf.pc.in b/netcdf.pc.in
+index 238e113..5593c16 100644
+--- a/netcdf.pc.in
++++ b/netcdf.pc.in
+@@ -2,12 +2,13 @@ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
+-ccompiler=@CC@
++ccompiler=false #redacted#
+
+ Name: @PACKAGE@
+ Description: NetCDF Client Library for C
+ URL: https://www.unidata.ucar.edu/netcdf
+ Version: @PACKAGE_VERSION@
+ Libs: -L${libdir} @NC_LIBS@
+-Libs.private: @LIBS@
++Libs.private: @NC_LIBS_PRIVATE@
+ Cflags: -I${includedir}
++Requires.private: @NC_REQUIRES_PRIVATE@
diff --git a/vcpkg/ports/netcdf-c/mremap.diff b/vcpkg/ports/netcdf-c/mremap.diff
new file mode 100644
index 0000000..74adf01
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/mremap.diff
@@ -0,0 +1,13 @@
+diff --git a/libsrc/mmapio.c b/libsrc/mmapio.c
+index 98b9ddb..8a27946 100644
+--- a/libsrc/mmapio.c
++++ b/libsrc/mmapio.c
+@@ -44,7 +44,7 @@
+
+ #ifdef HAVE_MREMAP
+ /* This is conditionalized by __USE_GNU ; why? */
+- extern void *mremap(void*,size_t,size_t,int);
++ extern void *mremap(void*,size_t,size_t,int,...);
+ # ifndef MREMAP_MAYMOVE
+ # define MREMAP_MAYMOVE 1
+ # endif
diff --git a/vcpkg/ports/netcdf-c/no-install-deps.patch b/vcpkg/ports/netcdf-c/no-install-deps.patch
new file mode 100644
index 0000000..3788ae8
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/no-install-deps.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 588a2ce..bbb647c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1557,6 +1557,7 @@ endif()
+ # in the libdir.
+ ##
+ if(MSVC)
++elseif(0)
+ foreach(CPP ${CMAKE_PREFIX_PATH})
+ file(GLOB COPY_FILES ${CPP}/lib/*.lib)
+ endforeach()
diff --git a/vcpkg/ports/netcdf-c/plugin-install-dir.diff b/vcpkg/ports/netcdf-c/plugin-install-dir.diff
new file mode 100644
index 0000000..1e55b28
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/plugin-install-dir.diff
@@ -0,0 +1,14 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bbb647c..34927c0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -667,6 +667,9 @@ endif()
+ if (DEFINED NETCDF_WITH_PLUGIN_DIR) # Table row 3
+ set(DEFAULT_PLUGIN_INSTALL_DIR "${NETCDF_WITH_PLUGIN_DIR}")
+ set(DEFAULT_PLUGIN_SEARCH_PATH "${NETCDF_WITH_PLUGIN_DIR}${PLATFORMSEP}${PLATFORMDEFAULT}")
++elseif (DEFINED CMAKE_INSTALL_PREFIX) # vcpkg: install, don't change search path
++ set(DEFAULT_PLUGIN_INSTALL_DIR "plugins/netcdf-c")
++ set(DEFAULT_PLUGIN_SEARCH_PATH "${PLATFORMDEFAULT}")
+ elseif (DEFINED CMAKE_INSTALL_PREFIX) # Table row 2
+ set(DEFAULT_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/hdf5/lib/plugin")
+ set(DEFAULT_PLUGIN_SEARCH_PATH "${DEFAULT_PLUGIN_INSTALL_DIR}${PLATFORMSEP}${PLATFORMDEFAULT}")
diff --git a/vcpkg/ports/netcdf-c/portfile.cmake b/vcpkg/ports/netcdf-c/portfile.cmake
new file mode 100644
index 0000000..3a6678b
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/portfile.cmake
@@ -0,0 +1,98 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Unidata/netcdf-c
+ REF "v${VERSION}"
+ SHA512 c82d77572a10e8d84f5c2db205f3b486add97195c1c29ee4747a6e435fbfb03e111ddb652e137086db04d820eb7542ffbac310e48fae01474f0892abad099ed6
+ HEAD_REF master
+ PATCHES
+ no-install-deps.patch
+ dependencies.diff
+ fix-pkgconfig.patch
+ mremap.diff
+ plugin-install-dir.diff
+)
+file(GLOB_RECURSE modules "${SOURCE_PATH}/cmake/modules/Find*.cmake")
+set(vendored_bzip2 blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c bzlib.h bzlib_private.h)
+list(TRANSFORM vendored_bzip2 PREPEND "${SOURCE_PATH}/plugins/")
+file(GLOB vendored_tinyxml2 "${SOURCE_PATH}/libncxml/tinyxml2.*")
+file(REMOVE ${modules} ${vendored_bzip2} ${vendored_tinyxml2})
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ dap NETCDF_ENABLE_DAP
+ nczarr NETCDF_ENABLE_NCZARR
+ nczarr-zip NETCDF_ENABLE_NCZARR_ZIP
+ netcdf-4 NETCDF_ENABLE_HDF5
+ plugins NETCDF_ENABLE_PLUGINS
+ plugins NETCDF_ENABLE_FILTER_BZ2
+ szip NETCDF_ENABLE_FILTER_SZIP
+ tools NETCDF_BUILD_UTILITIES
+ zstd NETCDF_ENABLE_FILTER_ZSTD
+ )
+
+if(NETCDF_ENABLE_DAP OR NETCDF_ENABLE_NCZARR)
+ list(APPEND FEATURE_OPTIONS "-DVCPKG_LOCK_FIND_PACKAGE_CURL=ON")
+else()
+ list(APPEND FEATURE_OPTIONS "-DVCPKG_LOCK_FIND_PACKAGE_CURL=OFF")
+endif()
+
+if(VCPKG_TARGET_IS_UWP)
+ string(APPEND VCPKG_C_FLAGS " /wd4996 /wd4703")
+ string(APPEND VCPKG_CXX_FLAGS " /wd4996 /wd4703")
+endif()
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ list(APPEND FEATURE_OPTIONS "-DHAVE_DIRENT_H=OFF")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ DISABLE_PARALLEL_CONFIGURE # netcdf-c configures in the source!
+ OPTIONS
+ -DBUILD_TESTING=OFF
+ -DENABLE_PLUGIN_INSTALL=ON
+ -DNETCDF_ENABLE_DAP_REMOTE_TESTS=OFF
+ -DNETCDF_ENABLE_EXAMPLES=OFF
+ -DNETCDF_ENABLE_FILTER_BLOSC=OFF
+ -DNETCDF_ENABLE_FILTER_TESTING=OFF
+ -DNETCDF_ENABLE_LIBXML2=OFF
+ -DNETCDF_ENABLE_S3=OFF
+ -DNETCDF_ENABLE_TESTS=OFF
+ -DVCPKG_LOCK_FIND_PACKAGE_MakeDist=OFF
+ -DVCPKG_LOCK_FIND_PACKAGE_PkgConfig=OFF
+ -DVCPKG_LOCK_FIND_PACKAGE_ZLIB=ON
+ ${FEATURE_OPTIONS}
+ MAYBE_UNUSED_VARIABLES
+ ENABLE_PLUGIN_INSTALL
+ VCPKG_LOCK_FIND_PACKAGE_CURL
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/netCDF")
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/netcdf.h" "defined(DLL_NETCDF)" "1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/nc-config" "${CURRENT_PACKAGES_DIR}/bin/nc-config") # invalid
+if("tools" IN_LIST FEATURES)
+ vcpkg_copy_tools(
+ TOOL_NAMES nccopy ncdump ncgen ncgen3
+ AUTO_CLEAN
+ )
+else()
+ vcpkg_clean_executables_in_bin(FILE_NAMES none)
+endif()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+ "${CURRENT_PACKAGES_DIR}/debug/lib/libnetcdf.settings"
+ "${CURRENT_PACKAGES_DIR}/lib/libnetcdf.settings"
+)
+
+set(ncpoco_copyright "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libncpoco COPYRIGHT")
+file(COPY_FILE "${SOURCE_PATH}/libncpoco/COPYRIGHT" "${ncpoco_copyright}")
+set(ncpoco_source_license "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libncpoco SourceLicence")
+file(COPY_FILE "${SOURCE_PATH}/libncpoco/SourceLicence" "${ncpoco_source_license}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYRIGHT" "${ncpoco_copyright}" "${ncpoco_source_license}")
diff --git a/vcpkg/ports/netcdf-c/use_targets.patch b/vcpkg/ports/netcdf-c/use_targets.patch
new file mode 100644
index 0000000..4124c9a
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/use_targets.patch
@@ -0,0 +1,130 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dac5992..09910b1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -484,7 +484,6 @@ IF(NC_EXTRA_DEPS)
+ ENDIF()
+ SET(EXTRA_DEPS ${EXTRA_DEPS} "${${_LIB}_DEP}")
+ ENDFOREACH()
+- MESSAGE("Extra deps: ${EXTRA_DEPS}")
+ LIST(REMOVE_DUPLICATES EXTRA_DEPS)
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${EXTRA_DEPS})
+ ENDIF()
+@@ -721,15 +720,6 @@ IF(USE_HDF5)
+ # we will use a static library. This can be toggled
+ # by explicitly modifying NC_FIND_SHARED_LIBS.
+ ##
+- IF(NC_FIND_SHARED_LIBS)
+- SET(NC_HDF5_LINK_TYPE "shared")
+- SET(NC_HDF5_LINK_TYPE_UPPER "SHARED")
+- ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
+- ELSE(NC_FIND_SHARED_LIBS)
+- SET(NC_HDF5_LINK_TYPE "static")
+- SET(NC_HDF5_LINK_TYPE_UPPER "STATIC")
+- ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB)
+- ENDIF(NC_FIND_SHARED_LIBS)
+
+ #####
+ # First, find the C and HL libraries.
+@@ -742,7 +732,7 @@ IF(USE_HDF5)
+ SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
+ FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE})
+ ELSE(MSVC)
+- FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
++ FIND_PACKAGE(HDF5 COMPONENTS C HL CONFIG REQUIRED)
+ ENDIF(MSVC)
+
+ ##
+@@ -857,6 +847,19 @@ IF(USE_HDF5)
+
+ ENDIF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)
+
++ if(TARGET hdf5::hdf5-shared)
++ set(HDF5_C_LIBRARY hdf5::hdf5-shared)
++ set(HDF5_C_LIBRARY_hdf5 hdf5::hdf5-shared)
++ set(HDF5_HL_LIBRARIES hdf5::hdf5_hl-shared)
++ ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)
++ else()
++ set(HDF5_C_LIBRARY hdf5::hdf5-static)
++ set(HDF5_C_LIBRARY_hdf5 hdf5::hdf5-static)
++ set(HDF5_HL_LIBRARIES hdf5::hdf5_hl-static)
++ ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB)
++ endif()
++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${HDF5_C_LIBRARY})
++
+ FIND_PACKAGE(Threads)
+
+ # There is a missing case in the above code so default it
+@@ -985,11 +988,14 @@ ENDIF(USE_HDF5)
+
+ # See if we have libcurl
+ FIND_PACKAGE(CURL)
+-ADD_DEFINITIONS(-DCURL_STATICLIB=1)
+ INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
+
+ # Define a test flag for have curl library
+-IF(CURL_LIBRARIES OR CURL_LIBRARY)
++IF(CURL_FOUND)
++ SET(CURL_LIBRARY CURL::libcurl)
++ if(CURL_VERSION VERSION_GREATER_EQUAL "7.66")
++ set(HAVE_LIBCURL_766 TRUE CACHE INTERNAL "vcpkg")
++ endif()
+ SET(FOUND_CURL TRUE)
+ ELSE()
+ SET(FOUND_CURL FALSE)
+@@ -2464,10 +2470,9 @@ IF(NC_LIBS)
+ STRING(REPLACE "-lhdf5::hdf5_hl-static" "-lhdf5_hl" NC_LIBS ${NC_LIBS})
+ ENDIF()
+
+-STRING(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")
+-
+-LIST(REMOVE_DUPLICATES NC_LIBS)
++LIST(REMOVE_ITEM LINKFLAGS "-L")
+ LIST(REMOVE_DUPLICATES LINKFLAGS)
++STRING(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")
+
+ SET(LIBS ${NC_LIBS})
+ SET(NC_LIBS "-lnetcdf")
+diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
+index 5e1692f..882f1dd 100644
+--- a/liblib/CMakeLists.txt
++++ b/liblib/CMakeLists.txt
+@@ -77,6 +77,12 @@ IF(HAVE_LIBDL)
+ ENDIF()
+
+ IF(USE_HDF5)
++ if(TARGET hdf5::hdf5-shared)
++ SET(TLL_LIBS ${TLL_LIBS} hdf5::hdf5-shared hdf5::hdf5_hl-shared)
++ else()
++ SET(TLL_LIBS ${TLL_LIBS} hdf5::hdf5-static hdf5::hdf5_hl-static)
++ endif()
++elseif(0)
+ IF(NOT MSVC)
+ # Some version of cmake define HDF5_hdf5_LIBRARY instead of
+ # HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES
+@@ -118,7 +124,6 @@ IF(ENABLE_S3_SDK)
+ ENDIF()
+
+ IF(TLL_LIBS)
+- LIST(REMOVE_DUPLICATES TLL_LIBS)
+ ENDIF()
+
+ TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
+diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in
+index 9d68eec..715e33e 100644
+--- a/netCDFConfig.cmake.in
++++ b/netCDFConfig.cmake.in
+@@ -12,6 +12,13 @@ set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+ set(netCDF_LIBRARIES netCDF::netcdf)
+
+ # include target information
++include(CMakeFindDependencyMacro)
++if("@USE_HDF5@")
++ find_dependency(HDF5 CONFIG)
++endif()
++if("@FOUND_CURL@")
++ find_dependency(CURL CONFIG)
++endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake")
+
+ # Compiling Options
diff --git a/vcpkg/ports/netcdf-c/vcpkg.json b/vcpkg/ports/netcdf-c/vcpkg.json
new file mode 100644
index 0000000..ea311ca
--- /dev/null
+++ b/vcpkg/ports/netcdf-c/vcpkg.json
@@ -0,0 +1,125 @@
+{
+ "name": "netcdf-c",
+ "version": "4.9.3",
+ "description": "A set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.",
+ "homepage": "https://github.com/Unidata/netcdf-c",
+ "license": null,
+ "dependencies": [
+ "tinyxml2",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ },
+ "zlib"
+ ],
+ "default-features": [
+ "dap",
+ {
+ "name": "nczarr",
+ "platform": "!uwp"
+ },
+ {
+ "name": "netcdf-4",
+ "platform": "!uwp"
+ }
+ ],
+ "features": {
+ "dap": {
+ "description": "DAP remote access client support",
+ "dependencies": [
+ {
+ "name": "curl",
+ "default-features": false
+ }
+ ]
+ },
+ "nczarr": {
+ "description": "NCZarr cloud storage access support",
+ "dependencies": [
+ {
+ "name": "curl",
+ "default-features": false
+ },
+ {
+ "name": "netcdf-c",
+ "default-features": false,
+ "features": [
+ "netcdf-4"
+ ]
+ }
+ ]
+ },
+ "nczarr-zip": {
+ "description": "NCZarr ZIP support",
+ "dependencies": [
+ {
+ "name": "libzip",
+ "default-features": false
+ },
+ {
+ "name": "netcdf-c",
+ "default-features": false,
+ "features": [
+ "nczarr"
+ ]
+ }
+ ]
+ },
+ "netcdf-4": {
+ "description": "netCDF-4 support",
+ "dependencies": [
+ {
+ "name": "hdf5",
+ "default-features": false,
+ "features": [
+ "zlib"
+ ]
+ }
+ ]
+ },
+ "plugins": {
+ "description": "Enable plugin support",
+ "supports": "!static & !uwp",
+ "dependencies": [
+ {
+ "name": "bzip2",
+ "default-features": false
+ },
+ "zlib"
+ ]
+ },
+ "szip": {
+ "description": "Szip compression plugin",
+ "dependencies": [
+ "libaec",
+ {
+ "name": "netcdf-c",
+ "default-features": false,
+ "features": [
+ "plugins"
+ ]
+ }
+ ]
+ },
+ "tools": {
+ "description": "Build utilities"
+ },
+ "zstd": {
+ "description": "Zstandard compression plugin",
+ "dependencies": [
+ {
+ "name": "netcdf-c",
+ "default-features": false,
+ "features": [
+ "plugins"
+ ]
+ },
+ "zstd"
+ ]
+ }
+ }
+}