deps.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
  2. index d06a276..b7ada29 100644
  3. --- a/cmake/dependencies.cmake
  4. +++ b/cmake/dependencies.cmake
  5. @@ -134,7 +134,14 @@ if(USE_HDF5)
  6. #####
  7. # First, find the C and HL libraries.
  8. #####
  9. - find_package(HDF5 COMPONENTS C HL REQUIRED)
  10. + find_package(HDF5 NO_MODULE COMPONENTS C HL REQUIRED)
  11. + if(TARGET hdf5::hdf5-static)
  12. + add_library(HDF5::HDF5 ALIAS hdf5::hdf5-static)
  13. + add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-static)
  14. + else()
  15. + add_library(HDF5::HDF5 ALIAS hdf5::hdf5-shared)
  16. + add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-shared)
  17. + endif()
  18. message(STATUS "Found HDF5 version: ${HDF5_VERSION}")
  19. if(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED})
  20. @@ -173,6 +180,13 @@ if(USE_HDF5)
  21. message(STATUS "HDF5 has zlib.")
  22. endif()
  23. + if(NOT TARGET ZLIB::ZLIB)
  24. + add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
  25. + set_target_properties(ZLIB::ZLIB PROPERTIES
  26. + IMPORTED_LOCATION "${ZLIB_LIBRARY}"
  27. + INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}"
  28. + )
  29. + endif()
  30. # Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip library.
  31. check_hdf5_feature(HAVE_H5Z_SZIP H5_HAVE_FILTER_SZIP)
  32. @@ -466,8 +480,8 @@ endif()
  33. ################################
  34. # see if we have libxml2
  35. if(NETCDF_ENABLE_LIBXML2)
  36. - find_package(LibXml2)
  37. - if(LibXml2_FOUND)
  38. + find_package(libxml2 CONFIG REQUIRED)
  39. + if(TARGET LibXml2::LibXml2)
  40. set(HAVE_LIBXML2 TRUE)
  41. target_include_directories(netcdf
  42. PRIVATE
  43. diff --git a/libdispatch/CMakeLists.txt b/libdispatch/CMakeLists.txt
  44. index 0f5d66d..2f65518 100644
  45. --- a/libdispatch/CMakeLists.txt
  46. +++ b/libdispatch/CMakeLists.txt
  47. @@ -14,6 +14,8 @@ target_sources(dispatch
  48. ncproplist.c
  49. )
  50. +target_link_libraries(dispatch PUBLIC CURL::libcurl ${CURL_LIBRARIES})
  51. +
  52. if (NETCDF_ENABLE_DLL)
  53. target_compile_definitions(dispatch PRIVATE DLL_NETCDF DLL_EXPORT)
  54. endif()
  55. diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt
  56. index 9281a25..61198b2 100644
  57. --- a/libhdf5/CMakeLists.txt
  58. +++ b/libhdf5/CMakeLists.txt
  59. @@ -17,6 +17,8 @@ target_sources(netcdfhdf5 PRIVATE
  60. hdf5set_format_compatibility.c hdf5debug.c
  61. )
  62. +target_link_libraries(netcdfhdf5 PUBLIC CURL::libcurl)
  63. +
  64. if (NETCDF_ENABLE_DLL)
  65. target_compile_definitions(netcdfhdf5 PRIVATE DLL_NETCDF DLL_EXPORT)
  66. endif()
  67. diff --git a/libncxml/CMakeLists.txt b/libncxml/CMakeLists.txt
  68. index b8fa4b2..f881a92 100644
  69. --- a/libncxml/CMakeLists.txt
  70. +++ b/libncxml/CMakeLists.txt
  71. @@ -12,6 +12,7 @@ if(HAVE_LIBXML2)
  72. PRIVATE
  73. ${LIBXML2_INCLUDE_DIRS}
  74. )
  75. +target_link_libraries(ncxml PUBLIC LibXml2::LibXml2)
  76. else()
  77. target_include_directories(ncxml
  78. PUBLIC
  79. diff --git a/libncxml/ncxml_xml2.c b/libncxml/ncxml_xml2.c
  80. index 12132a7..7da27d5 100644
  81. --- a/libncxml/ncxml_xml2.c
  82. +++ b/libncxml/ncxml_xml2.c
  83. @@ -3,7 +3,7 @@
  84. #include <stddef.h>
  85. #include <stdlib.h>
  86. #include <string.h>
  87. -#include <libxml2/libxml/parser.h>
  88. +#include <libxml/parser.h>
  89. #include <libxml/tree.h>
  90. #include "ncxml.h"
  91. diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in
  92. index 987b2ad..32eba6d 100644
  93. --- a/netCDFConfig.cmake.in
  94. +++ b/netCDFConfig.cmake.in
  95. @@ -40,9 +40,14 @@ set(netCDF_HAS_DAP2 @HAS_DAP2@)
  96. set(netCDF_HAS_DAP4 @HAS_DAP4@)
  97. set(netCDF_HAS_DISKLESS @HAS_DISKLESS@)
  98. set(netCDF_HAS_MMAP @HAS_MMAP@)
  99. +
  100. +
  101. +include(CMakeFindDependencyMacro)
  102. +find_dependency(CURL)
  103. +
  104. if (netCDF_HAS_HDF4 OR netCDF_HAS_HDF5)
  105. include(CMakeFindDependencyMacro)
  106. - find_dependency(HDF5)
  107. + find_dependency(HDF5 CONFIG)
  108. endif ()
  109. if (@HAS_PARALLEL@)
  110. diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
  111. index fbaeb21..740bdb1 100644
  112. --- a/plugins/CMakeLists.txt
  113. +++ b/plugins/CMakeLists.txt
  114. @@ -58,7 +58,7 @@ macro(buildplugin TARGET TARGETLIB)
  115. set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_NAME ${MANGLELIB})
  116. set_target_properties(${TARGET} PROPERTIES PREFIX "") # Critical that this be set to ""
  117. set_target_properties(${TARGET} PROPERTIES SUFFIX ".${PLUGINEXT}")
  118. - target_link_libraries(${TARGET} PUBLIC ${ALL_TLL_LIBS};${ARGN})
  119. + target_link_libraries(${TARGET} PUBLIC ${ALL_TLL_LIBS};${ARGN};ZLIB::ZLIB)
  120. if(MSVC)
  121. target_compile_options(${TARGET} PRIVATE /Zi)
  122. # Tell linker to include symbol data