mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Merge pull request #2907 from WardF/fix_curl_dep.wif
Remove superflous check for libcurl
This commit is contained in:
commit
b0b5853bcc
@ -468,6 +468,7 @@ message(">>> NETCDF_ENABLE_REMOTE_FUNCTIONALITY=${NETCDF_ENABLE_REMOTE_FUNCTIONA
|
||||
if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
|
||||
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP[4]=NO")
|
||||
set(NETCDF_ENABLE_DAP OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP=NO" FORCE)
|
||||
set(NETCDF_ENABLE_DAP2 OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP2=NO" FORCE)
|
||||
set(NETCDF_ENABLE_DAP4 OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP4=NO" FORCE)
|
||||
endif()
|
||||
|
||||
@ -544,7 +545,7 @@ else()
|
||||
endif()
|
||||
|
||||
# Option to support byte-range reading of remote datasets
|
||||
option(NETCDF_ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." ON)
|
||||
option(NETCDF_ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." ${NETCDF_ENABLE_DAP})
|
||||
if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY)
|
||||
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_BYTERANGE=NO")
|
||||
set(NETCDF_ENABLE_BYTERANGE OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_BYTERANGE=NO" FORCE)
|
||||
|
@ -26,7 +26,7 @@ install:
|
||||
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
|
||||
- cmd: conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
|
||||
- cmd: conda update conda
|
||||
- cmd: conda install hdf5=1.8.18 curl hdf4
|
||||
- cmd: conda install hdf5=1.8.18 curl hdf4 zlib
|
||||
|
||||
configuration: Release
|
||||
|
||||
@ -36,7 +36,7 @@ build: off
|
||||
build_script:
|
||||
- cmd: mkdir build
|
||||
- cmd: cd build
|
||||
- cmd: cmake .. -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_LOC% -DNETCDF_ENABLE_BASH_SCRIPT_TESTING=OFF -DNETCDF_ENABLE_FILTER_TESTING=OFF -DNETCDF_ENABLE_BYTERANGE=ON
|
||||
- cmd: cmake .. -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_LOC% -DNETCDF_ENABLE_BASH_SCRIPT_TESTING=OFF -DNETCDF_ENABLE_FILTER_TESTING=OFF -DNETCDF_ENABLE_BYTERANGE=ON -DCMAKE_PREFIX_PATH=%CONDA_INSTALL_LOCN%
|
||||
- cmd: if errorlevel 1 exit 1
|
||||
- cmd: cmake --build . --config Release -- /maxcpucount:4
|
||||
|
||||
|
@ -214,101 +214,110 @@ if(USE_HDF5)
|
||||
endif(USE_HDF5)
|
||||
|
||||
################################
|
||||
# Curl
|
||||
# Curl Libraryies
|
||||
# Only needed for DAP (DAP2 or DAP4)
|
||||
# and NCZARR with S3 Support
|
||||
################################
|
||||
# See if we have libcurl
|
||||
find_package(CURL)
|
||||
#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)
|
||||
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)
|
||||
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling")
|
||||
set(NETCDF_ENABLE_REMOTE_FUNCTIONALITY OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling" FORCE )
|
||||
endif()
|
||||
|
||||
set (CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
|
||||
# Check to see if we have libcurl 7.66 or later
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {
|
||||
#if LIBCURL_VERSION_NUM < 0x074200
|
||||
choke me;
|
||||
#endif
|
||||
}" HAVE_LIBCURL_766)
|
||||
|
||||
IF (HAVE_LIBCURL_766)
|
||||
# If libcurl version is >= 7.66, then can skip tests
|
||||
# for these symbols which were added in an earlier version
|
||||
set(HAVE_CURLOPT_USERNAME TRUE)
|
||||
set(HAVE_CURLOPT_PASSWORD TRUE)
|
||||
set(HAVE_CURLOPT_KEYPASSWD TRUE)
|
||||
set(HAVE_CURLINFO_RESPONSE_CODE TRUE)
|
||||
set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE)
|
||||
set(HAVE_CURLOPT_BUFFERSIZE TRUE)
|
||||
set(HAVE_CURLOPT_KEEPALIVE TRUE)
|
||||
else()
|
||||
# Check to see if CURLOPT_USERNAME is defined.
|
||||
# It is present starting version 7.19.1.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)
|
||||
|
||||
# Check to see if CURLOPT_PASSWORD is defined.
|
||||
# It is present starting version 7.19.1.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)
|
||||
|
||||
# Check to see if CURLOPT_KEYPASSWD is defined.
|
||||
# It is present starting version 7.16.4.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)
|
||||
|
||||
# Check to see if CURLINFO_RESPONSE_CODE is defined.
|
||||
# It showed up in curl 7.10.7.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
|
||||
|
||||
# Check to see if CURLINFO_HTTP_CONNECTCODE is defined.
|
||||
# It showed up in curl 7.10.7.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE)
|
||||
|
||||
# Check to see if CURLOPT_BUFFERSIZE is defined.
|
||||
# It is present starting version 7.59
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE)
|
||||
|
||||
# Check to see if CURLOPT_TCP_KEEPALIVE is defined.
|
||||
# It is present starting version 7.25
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE)
|
||||
if( (NETCDF_ENABLE_DAP AND (NETCDF_ENABLE_DAP2 OR NETCDF_ENABLE_DAP4 OR NETCDF_ENABLE_BYTERANGE_SUPPORT)) OR (NETCDF_ENABLE_NCZARR AND NETCDF_ENABLENCZARR_S3))
|
||||
|
||||
# See if we have libcurl
|
||||
find_package(CURL)
|
||||
#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)
|
||||
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)
|
||||
message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling")
|
||||
set(NETCDF_ENABLE_REMOTE_FUNCTIONALITY OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY requires libcurl; disabling" FORCE )
|
||||
endif()
|
||||
|
||||
set (CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
|
||||
# Check to see if we have libcurl 7.66 or later
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {
|
||||
#if LIBCURL_VERSION_NUM < 0x074200
|
||||
choke me;
|
||||
#endif
|
||||
}" HAVE_LIBCURL_766)
|
||||
|
||||
IF (HAVE_LIBCURL_766)
|
||||
# If libcurl version is >= 7.66, then can skip tests
|
||||
# for these symbols which were added in an earlier version
|
||||
set(HAVE_CURLOPT_USERNAME TRUE)
|
||||
set(HAVE_CURLOPT_PASSWORD TRUE)
|
||||
set(HAVE_CURLOPT_KEYPASSWD TRUE)
|
||||
set(HAVE_CURLINFO_RESPONSE_CODE TRUE)
|
||||
set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE)
|
||||
set(HAVE_CURLOPT_BUFFERSIZE TRUE)
|
||||
set(HAVE_CURLOPT_KEEPALIVE TRUE)
|
||||
else()
|
||||
# Check to see if CURLOPT_USERNAME is defined.
|
||||
# It is present starting version 7.19.1.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)
|
||||
|
||||
# Check to see if CURLOPT_PASSWORD is defined.
|
||||
# It is present starting version 7.19.1.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)
|
||||
|
||||
# Check to see if CURLOPT_KEYPASSWD is defined.
|
||||
# It is present starting version 7.16.4.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)
|
||||
|
||||
# Check to see if CURLINFO_RESPONSE_CODE is defined.
|
||||
# It showed up in curl 7.10.7.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
|
||||
|
||||
# Check to see if CURLINFO_HTTP_CONNECTCODE is defined.
|
||||
# It showed up in curl 7.10.7.
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE)
|
||||
|
||||
# Check to see if CURLOPT_BUFFERSIZE is defined.
|
||||
# It is present starting version 7.59
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE)
|
||||
|
||||
# Check to see if CURLOPT_TCP_KEEPALIVE is defined.
|
||||
# It is present starting version 7.25
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <curl/curl.h>
|
||||
int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE)
|
||||
endif()
|
||||
endif()
|
||||
################################
|
||||
# End LibCurl stuff
|
||||
################################
|
||||
|
||||
################################
|
||||
# Math
|
||||
|
@ -148,7 +148,7 @@ if(USE_HDF5)
|
||||
endif()
|
||||
|
||||
if(FOUND_CURL)
|
||||
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl ${CURL_LIBRARIES})
|
||||
set(TLL_LIBS ${TLL_LIBS} CURL::libcurl)
|
||||
endif()
|
||||
|
||||
if(USE_HDF4)
|
||||
|
Loading…
Reference in New Issue
Block a user