2018-12-07 05:34:40 +08:00
|
|
|
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
|
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
|
|
|
# 2015, 2016, 2017, 2018
|
|
|
|
# University Corporation for Atmospheric Research/Unidata.
|
2014-12-06 02:19:02 +08:00
|
|
|
|
2018-12-07 05:34:40 +08:00
|
|
|
# See netcdf-c/COPYRIGHT file for more info.
|
2012-07-18 05:44:41 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
#####
|
|
|
|
# Add target objects/modules based on options.
|
|
|
|
#####
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-27 03:29:38 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:netcdf3>
|
|
|
|
$<TARGET_OBJECTS:dispatch>
|
2024-01-27 03:29:38 +08:00
|
|
|
)
|
2012-07-26 06:09:19 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
if(USE_NETCDF4)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:netcdf4>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_HDF5)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:netcdfhdf5>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_PNETCDF)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:netcdfp>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_HDF4)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:netcdfhdf4>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-04-04 01:42:59 +08:00
|
|
|
if(FOUND_CURL)
|
|
|
|
target_link_libraries(netcdf PRIVATE CURL::libcurl)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 04:32:23 +08:00
|
|
|
if(NETCDF_ENABLE_DAP2)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:oc2>
|
|
|
|
$<TARGET_OBJECTS:dap2>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 04:32:23 +08:00
|
|
|
if(NETCDF_ENABLE_DAP4)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:dap4>
|
|
|
|
$<TARGET_OBJECTS:ncxml>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 04:37:39 +08:00
|
|
|
if(NETCDF_ENABLE_NCZARR)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:nczarr>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 05:27:23 +08:00
|
|
|
if(NETCDF_ENABLE_S3_INTERNAL)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:ncxml>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 04:40:00 +08:00
|
|
|
if(NETCDF_ENABLE_PLUGINS)
|
2024-02-08 05:55:19 +08:00
|
|
|
target_sources(netcdf
|
2024-01-19 23:25:24 +08:00
|
|
|
PRIVATE
|
2024-02-08 04:09:57 +08:00
|
|
|
$<TARGET_OBJECTS:ncpoco>
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_sources(netcdf
|
2024-01-27 04:28:16 +08:00
|
|
|
PRIVATE
|
2024-01-27 03:29:38 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/nc_initialize.c
|
2024-01-19 23:25:24 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if(STATUS_PARALLEL)
|
2024-02-07 23:53:45 +08:00
|
|
|
target_link_libraries(netcdf PUBLIC MPI::MPI_C)
|
2024-01-19 23:25:24 +08:00
|
|
|
endif(STATUS_PARALLEL)
|
2021-01-20 01:33:08 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
if(MOD_NETCDF_NAME)
|
2024-02-07 23:53:45 +08:00
|
|
|
set_target_properties(netcdf
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME ${NETCDF_LIB_NAME}
|
|
|
|
)
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2012-07-21 05:16:27 +08:00
|
|
|
|
2018-01-18 04:24:14 +08:00
|
|
|
# Make sure that netcdf.dll path does not include the build configuration
|
2024-02-29 07:29:23 +08:00
|
|
|
#if(MSVC)
|
|
|
|
# set_target_properties(netcdf PROPERTIES
|
|
|
|
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
# RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
# RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
#endif()
|
2018-01-17 04:28:30 +08:00
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
#####
|
|
|
|
# Add dependencies required for linking.
|
|
|
|
#####
|
2013-02-13 06:22:54 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS "")
|
2013-02-13 06:22:54 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ${ZLIB_LIBRARY})
|
2013-02-13 06:22:54 +08:00
|
|
|
|
2014-09-30 02:04:35 +08:00
|
|
|
# Add extra dependencies specified via NC_EXTRA_DEPS
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS})
|
|
|
|
|
2024-03-19 04:37:39 +08:00
|
|
|
if(NETCDF_ENABLE_NCZARR_ZIP)
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(Blosc_FOUND)
|
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Blosc_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
if(Zstd_FOUND)
|
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Zstd_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
if(Bz2_FOUND)
|
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Bz2_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
if(SZIP_FOUND)
|
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Szip_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_LIBDL)
|
|
|
|
set(TLL_LIBS ${LIBDL} ${TLL_LIBS})
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 04:37:39 +08:00
|
|
|
if(NETCDF_ENABLE_NCZARR_ZIP)
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${Zip_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_HDF5)
|
2024-02-16 18:51:20 +08:00
|
|
|
set(TLL_LIBS HDF5::HDF5 hdf5::hdf5_hl ${TLL_LIBS} ${Szip_LIBRARY})
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2012-08-07 01:27:08 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
if(FOUND_CURL)
|
2024-04-09 00:34:22 +08:00
|
|
|
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl)
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2012-07-21 05:16:27 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
if(USE_HDF4)
|
2024-03-08 08:02:26 +08:00
|
|
|
set(TLL_LIBS ${HDF4_LIBRARIES} ${TLL_LIBS})
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2013-01-16 06:43:09 +08:00
|
|
|
|
2024-03-19 04:40:05 +08:00
|
|
|
if(NETCDF_ENABLE_PNETCDF)
|
2024-01-24 18:07:46 +08:00
|
|
|
SET(TLL_LIBS ${TLL_LIBS} PNETCDF::PNETCDF)
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2014-11-04 01:43:43 +08:00
|
|
|
|
2023-08-30 01:15:15 +08:00
|
|
|
|
2024-03-19 05:27:23 +08:00
|
|
|
if(NETCDF_ENABLE_S3)
|
|
|
|
if(NETCDF_ENABLE_S3_AWS)
|
2024-02-08 03:37:36 +08:00
|
|
|
target_link_directories(netcdf PUBLIC ${AWSSDK_LIB_DIR})
|
2024-01-19 23:25:24 +08:00
|
|
|
set(TLL_LIBS ${AWSSDK_LINK_LIBRARIES} ${TLL_LIBS})
|
2024-03-19 05:27:23 +08:00
|
|
|
elseif(NETCDF_ENABLE_S3_INTERNAL)
|
2024-01-19 23:25:24 +08:00
|
|
|
if(OPENSSL_FOUND)
|
|
|
|
set(TLL_LIBS ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} ${TLL_LIBS})
|
|
|
|
endif(OPENSSL_FOUND)
|
2024-03-19 05:27:23 +08:00
|
|
|
endif(NETCDF_ENABLE_S3_AWS)
|
|
|
|
endif(NETCDF_ENABLE_S3)
|
2024-01-19 23:25:24 +08:00
|
|
|
|
|
|
|
if(HAVE_LIBXML2)
|
|
|
|
set(TLL_LIBS ${TLL_LIBS} ${LIBXML2_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
if(NOT APPLE)
|
|
|
|
if(CMAKE_DL_LIBS)
|
2024-02-08 03:37:36 +08:00
|
|
|
target_link_libraries(netcdf PRIVATE ${CMAKE_DL_LIBS})
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-09-03 07:04:26 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
if(TLL_LIBS)
|
|
|
|
list(REMOVE_DUPLICATES TLL_LIBS)
|
|
|
|
endif()
|
2014-11-04 01:43:43 +08:00
|
|
|
|
2024-02-08 03:37:36 +08:00
|
|
|
target_link_libraries(netcdf PRIVATE ${TLL_LIBS})
|
2020-08-18 09:15:47 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${TLL_LIBS})
|
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(netcdf PROPERTIES
|
2024-03-12 06:02:54 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2024-01-19 23:25:24 +08:00
|
|
|
endif()
|
2012-09-14 02:27:23 +08:00
|
|
|
|
2024-03-19 04:40:43 +08:00
|
|
|
if(NETCDF_ENABLE_SHARED_LIBRARY_VERSION)
|
2024-01-19 23:25:24 +08:00
|
|
|
set_target_properties(netcdf PROPERTIES
|
2016-03-08 05:04:52 +08:00
|
|
|
VERSION ${netCDF_LIB_VERSION}
|
|
|
|
SOVERSION ${netCDF_SO_VERSION}
|
|
|
|
)
|
2024-03-19 04:40:43 +08:00
|
|
|
endif(NETCDF_ENABLE_SHARED_LIBRARY_VERSION)
|
2012-11-20 05:43:12 +08:00
|
|
|
|
2024-02-10 06:27:18 +08:00
|
|
|
install(
|
|
|
|
TARGETS netcdf EXPORT netCDFTargets
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
|
|
)
|
2012-11-20 05:43:12 +08:00
|
|
|
|
2024-01-19 23:25:24 +08:00
|
|
|
set(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
|
|
|
|
set(NC_LIBS ${NC_LIBS} PARENT_SCOPE)
|
2013-06-04 00:42:04 +08:00
|
|
|
|
2024-01-27 03:29:38 +08:00
|
|
|
file(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
2024-01-19 23:25:24 +08:00
|
|
|
set(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
2013-08-14 00:00:22 +08:00
|
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|