From 1de37aca810150b2a98a4855912426fac731de40 Mon Sep 17 00:00:00 2001 From: mattjala Date: Thu, 2 May 2024 22:07:01 -0500 Subject: [PATCH] Use FindCURL module when CURL built with CMake --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed731a5..58a59d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -390,7 +390,7 @@ jobs: cmake -DHDF5_ROOT=${{github.workspace}}/hdf5install ` -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install ` -DCURL_ROOT=${{github.workspace}}/curl/install/ -DCMAKE_C_FLAGS="/DCURL_STATICLIB" ` - -DCURL_USE_STATIC_LIBRARIES=ON ` + -DCURL_USE_STATIC_LIBS=ON ` -DYAJL_ROOT=${{github.workspace}}/yajl/install/ ` -DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON ` -DCMAKE_BUILD_TYPE=Release .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9823f10..f26a24e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ foreach (policy endif () endforeach () - #----------------------------------------------------------------------------- # Instructions for use : Normal Build # @@ -119,23 +118,12 @@ endif () set (CURL_TARGET_LIBTYPE shared) +set(CURL_NO_CURL_CMAKE ON) +find_package (CURL 7.61 MODULE REQUIRED) -find_package (CURL 7.61 REQUIRED) if (CURL_FOUND) - # FindCURL module is not always found on windows; set paths manually - if (WIN32) - set (CURL_INCLUDE_DIRS "${CURL_ROOT}\\include") - set (LINK_LIBS ${LINK_LIBS} Ws2_32.lib Wldap32.lib) - - if (CURL_USE_STATIC_LIBRARIES) - set (CURL_LIBRARIES "${CURL_ROOT}\\lib\\libcurl.lib") - else () - set (CURL_LIBRARIES "${CURL_ROOT}\\bin\\libcurl.dll") - endif() - endif() - include_directories(${CURL_INCLUDE_DIRS}) - set (LINK_LIBS ${LINK_LIBS} ${CURL_LIBRARIES}) + set (LINK_LIBS ${LINK_LIBS} CURL::libcurl) else () message (FATAL_ERROR "cURL not found; please check CURL_ROOT") endif () @@ -386,10 +374,6 @@ if (BUILD_STATIC_LIBS) set (HDF5_VOL_REST_ENABLE_STATIC_LIB YES) set (LINK_STATIC_LIBS ${LINK_LIBS}) set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIB_TARGET} CACHE INTERNAL "Store which libraries should be exported" FORCE) - # Value is not automatically inherited from cache on Windows - # if (WIN32) - # set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIB_TARGET}) - # endif() endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON)