Skip to content

Commit 71f298b

Browse files
committed
Use FindCURL module when CURL built with CMake
1 parent 1e80108 commit 71f298b

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ jobs:
331331
cmake -DHDF5_ROOT=${{github.workspace}}/hdf5install `
332332
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install `
333333
-DCURL_ROOT=${{github.workspace}}/curl/install/ -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
334-
-DCURL_USE_STATIC_LIBRARIES=ON `
334+
-DCURL_USE_STATIC_LIBS=ON `
335335
-DYAJL_ROOT=${{github.workspace}}/yajl/install/ `
336336
-DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON `
337337
-DCMAKE_BUILD_TYPE=Release ..

CMakeLists.txt

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ foreach (policy
1414
endif ()
1515
endforeach ()
1616

17-
1817
#-----------------------------------------------------------------------------
1918
# Instructions for use : Normal Build
2019
#
@@ -119,23 +118,12 @@ endif ()
119118

120119
set (CURL_TARGET_LIBTYPE shared)
121120

121+
set(CURL_NO_CURL_CMAKE ON)
122+
find_package (CURL 7.61 MODULE REQUIRED)
122123

123-
find_package (CURL 7.61 REQUIRED)
124124
if (CURL_FOUND)
125-
# FindCURL module is not always found on windows; set paths manually
126-
if (WIN32)
127-
set (CURL_INCLUDE_DIRS "${CURL_ROOT}\\include")
128-
set (LINK_LIBS ${LINK_LIBS} Ws2_32.lib Wldap32.lib)
129-
130-
if (CURL_USE_STATIC_LIBRARIES)
131-
set (CURL_LIBRARIES "${CURL_ROOT}\\lib\\libcurl.lib")
132-
else ()
133-
set (CURL_LIBRARIES "${CURL_ROOT}\\bin\\libcurl.dll")
134-
endif()
135-
endif()
136-
137125
include_directories(${CURL_INCLUDE_DIRS})
138-
set (LINK_LIBS ${LINK_LIBS} ${CURL_LIBRARIES})
126+
set (LINK_LIBS ${LINK_LIBS} CURL::libcurl)
139127
else ()
140128
message (FATAL_ERROR "cURL not found; please check CURL_ROOT")
141129
endif ()
@@ -385,10 +373,6 @@ if (BUILD_STATIC_LIBS)
385373
set (HDF5_VOL_REST_ENABLE_STATIC_LIB YES)
386374
set (LINK_STATIC_LIBS ${LINK_LIBS})
387375
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)
388-
# Value is not automatically inherited from cache on Windows
389-
# if (WIN32)
390-
# set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIB_TARGET})
391-
# endif()
392376
endif ()
393377

394378
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

0 commit comments

Comments
 (0)