mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-06 00:59:08 +08:00
165 lines
5.4 KiB
Diff
165 lines
5.4 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index bd7c4f8..9e09cf3 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -430,7 +430,6 @@ IF(NC_EXTRA_DEPS)
|
|
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()
|
|
###
|
|
@@ -598,15 +597,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
# 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.
|
|
@@ -619,7 +609,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
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)
|
|
|
|
##
|
|
@@ -701,6 +691,19 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
SET(HDF5_C_LIBRARY hdf5)
|
|
ENDIF()
|
|
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)
|
|
|
|
@@ -728,17 +731,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
|
|
|
|
#Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
|
|
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Z_SZIP "" USE_SZIP)
|
|
+ set(USE_SZIP ${HDF5_ENABLE_SZIP_SUPPORT})
|
|
IF(USE_SZIP)
|
|
- FIND_LIBRARY(SZIP NAMES szip sz)
|
|
- IF(SZIP)
|
|
SET(HAVE_H5Z_SZIP 1)
|
|
- SET(SZIP_LIBRARY ${SZIP})
|
|
- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SZIP})
|
|
- MESSAGE(STATUS "HDF5 has szip.")
|
|
- ELSE()
|
|
- MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
|
|
- ENDIF()
|
|
ENDIF()
|
|
|
|
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HAVE_H5PSET_LIBVER_BOUNDS)
|
|
@@ -788,8 +783,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
ENDIF(USE_HDF5 OR ENABLE_NETCDF_4)
|
|
|
|
# See if we have libcurl
|
|
-FIND_PACKAGE(CURL)
|
|
-ADD_DEFINITIONS(-DCURL_STATICLIB=1)
|
|
+FIND_PACKAGE(CURL CONFIG)
|
|
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
|
|
|
|
# Check to see if CURLOPT_USERNAME is defined.
|
|
@@ -1893,7 +1887,6 @@ ENDIF()
|
|
|
|
STRING(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")
|
|
|
|
-LIST(REMOVE_DUPLICATES NC_LIBS)
|
|
LIST(REMOVE_DUPLICATES LINKFLAGS)
|
|
|
|
SET(LIBS ${NC_LIBS})
|
|
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
|
|
index ea9b029..8aeeab7 100644
|
|
--- a/liblib/CMakeLists.txt
|
|
+++ b/liblib/CMakeLists.txt
|
|
@@ -58,7 +58,7 @@ ENDIF()
|
|
|
|
SET(TLL_LIBS "")
|
|
|
|
-SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
|
|
+SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ZLIB::ZLIB)
|
|
|
|
# Add extra dependencies specified via NC_EXTRA_DEPS
|
|
SET(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS})
|
|
@@ -68,27 +68,15 @@ IF(HAVE_LIBDL)
|
|
ENDIF()
|
|
|
|
IF(USE_HDF5 OR USE_NETCDF4)
|
|
- IF(NOT MSVC)
|
|
- # Some version of cmake define HDF5_hdf5_LIBRARY instead of
|
|
- # HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES
|
|
- IF(HDF5_hdf5_LIBRARY AND NOT HDF5_C_LIBRARIES)
|
|
- SET(HDF5_C_LIBRARIES ${HDF5_hdf5_LIBRARY})
|
|
- ENDIF()
|
|
- IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARIES)
|
|
- SET(HDF5_HL_LIBRARIES ${HDF5_hdf5_hl_LIBRARY})
|
|
- ENDIF()
|
|
- # The order of the libraries is important here for static
|
|
- # builds:
|
|
- # Make sure that HDF5_C_LIBRARY appears *after*
|
|
- # HDF5_HL_LIBRARY.
|
|
- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
|
|
- ELSE() # Windows CMake defines HDF5_LIBRARIES.
|
|
- SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
|
|
- ENDIF()
|
|
+ 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()
|
|
ENDIF()
|
|
|
|
IF(USE_DAP)
|
|
- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY})
|
|
+ SET(TLL_LIBS ${TLL_LIBS} CURL::libcurl)
|
|
ENDIF()
|
|
|
|
IF(USE_HDF4)
|
|
@@ -100,7 +88,6 @@ IF(ENABLE_PNETCDF AND PNETCDF)
|
|
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..b8f6113 100644
|
|
--- a/netCDFConfig.cmake.in
|
|
+++ b/netCDFConfig.cmake.in
|
|
@@ -12,6 +12,10 @@ set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
|
|
set(netCDF_LIBRARIES netCDF::netcdf)
|
|
|
|
# include target information
|
|
+include(CMakeFindDependencyMacro)
|
|
+find_dependency(ZLIB)
|
|
+find_dependency(HDF5 CONFIG)
|
|
+find_dependency(CURL CONFIG)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake")
|
|
|
|
# Compiling Options
|