Skip to content

Commit

Permalink
Use FindCURL module when CURL built with CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed May 3, 2024
1 parent 27552d6 commit 1de37ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
22 changes: 3 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ foreach (policy
endif ()
endforeach ()


#-----------------------------------------------------------------------------
# Instructions for use : Normal Build
#
Expand Down Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1de37ac

Please sign in to comment.