mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Merge pull request #2904 from WardF/curl-cmake.wif
Modernize CURL in netCDF cmake
This commit is contained in:
commit
b1d4b4147f
@ -218,25 +218,27 @@ endif(USE_HDF5)
|
||||
################################
|
||||
# See if we have libcurl
|
||||
find_package(CURL)
|
||||
target_compile_options(netcdf
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
)
|
||||
target_include_directories(netcdf
|
||||
PRIVATE
|
||||
${CURL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
|
||||
MESSAGE(STATUS "Found CURL_INCLUDE_DIRS: ${CURL_INCLUDE_DIRS}")
|
||||
# Define a test flag for have curl library
|
||||
if(CURL_LIBRARIES OR CURL_LIBRARY)
|
||||
#target_compile_options(netcdf
|
||||
# PRIVATE
|
||||
# -DCURL_STATICLIB=1
|
||||
#)
|
||||
#target_include_directories(netcdf
|
||||
# PRIVATE
|
||||
# ${CURL_INCLUDE_DIRS}
|
||||
#)
|
||||
if(CURL_FOUND)
|
||||
set(FOUND_CURL TRUE)
|
||||
target_link_libraries(netcdf
|
||||
PRIVATE
|
||||
CURL::libcurl
|
||||
)
|
||||
else()
|
||||
set(FOUND_CURL FALSE)
|
||||
endif()
|
||||
set(FOUND_CURL ${FOUND_CURL} TRUE )
|
||||
set(NETCDF_ENABLE_DAP2 OFF)
|
||||
set(NETCDF_ENABLE_DAP4 OFF)
|
||||
set(NETCDF_ENABLE_BYTERANGE OFF)
|
||||
set(NETCDF_ENABLE_S3 OFF)
|
||||
endif(CURL_FOUND)
|
||||
|
||||
# Start disabling if curl not found
|
||||
if(NOT FOUND_CURL)
|
||||
|
@ -27,7 +27,7 @@ set_property(SOURCE ncd2dispatch.c
|
||||
add_library(dap2 OBJECT ${dap2_SOURCES})
|
||||
|
||||
|
||||
target_link_libraries(dap2 PUBLIC ${CURL_LIBRARIES})
|
||||
target_link_libraries(dap2 PUBLIC CURL::libcurl ${CURL_LIBRARIES})
|
||||
target_include_directories(dap2 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(dap2
|
||||
PRIVATE
|
||||
|
@ -20,7 +20,7 @@ set_property(SOURCE d4meta.c
|
||||
SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
add_library(dap4 OBJECT ${dap4_SOURCES})
|
||||
target_link_libraries(dap4 PUBLIC ${CURL_LIBRARIES})
|
||||
target_link_libraries(dap4 PUBLIC CURL::libcurl ${CURL_LIBRARIES})
|
||||
target_include_directories(dap4 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(dap4
|
||||
PRIVATE
|
||||
|
@ -42,6 +42,10 @@ if(USE_HDF4)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FOUND_CURL)
|
||||
target_link_libraries(netcdf PRIVATE CURL::libcurl)
|
||||
endif()
|
||||
|
||||
if(NETCDF_ENABLE_DAP2)
|
||||
target_sources(netcdf
|
||||
PRIVATE
|
||||
@ -144,7 +148,7 @@ if(USE_HDF5)
|
||||
endif()
|
||||
|
||||
if(FOUND_CURL)
|
||||
set(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
|
||||
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl ${CURL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_HDF4)
|
||||
|
@ -42,6 +42,7 @@ ENDif (USE_FFIO)
|
||||
|
||||
if (NETCDF_ENABLE_BYTERANGE)
|
||||
list(APPEND libsrc_SOURCES httpio.c)
|
||||
|
||||
if (NETCDF_ENABLE_S3)
|
||||
list(APPEND libsrc_SOURCES s3io.c)
|
||||
endif(NETCDF_ENABLE_S3)
|
||||
@ -55,6 +56,7 @@ endif()
|
||||
|
||||
if (NETCDF_ENABLE_BYTERANGE)
|
||||
target_include_directories(netcdf3 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_link_libraries(netcdf3 PUBLIC CURL::libcurl)
|
||||
target_compile_options(netcdf3
|
||||
PRIVATE
|
||||
-DCURL_STATICLIB=1
|
||||
|
@ -15,7 +15,7 @@ endif()
|
||||
if(STATUS_PARALLEL)
|
||||
target_link_libraries(oc2 PUBLIC MPI::MPI_C)
|
||||
endif(STATUS_PARALLEL)
|
||||
target_link_libraries(oc2 PUBLIC ${CURL_LIBRARIES})
|
||||
target_link_libraries(oc2 PUBLIC CURL::libcurl ${CURL_LIBRARIES})
|
||||
target_include_directories(oc2 PUBLIC ${CURL_INCLUDE_DIRS})
|
||||
target_compile_options(oc2
|
||||
PRIVATE
|
||||
|
Loading…
Reference in New Issue
Block a user