mirror of https://github.com/microsoft/vcpkg.git
247 lines
6.8 KiB
Diff
247 lines
6.8 KiB
Diff
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)
|