From 1e9fc9b024bfbd4ccc1c23e047a092f6a6d6d8b6 Mon Sep 17 00:00:00 2001 From: DcruBro Date: Fri, 8 May 2026 18:12:42 +0200 Subject: [PATCH] fetch depends --- CMakeLists.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2926f0c..36bf31d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,20 @@ if(NOT OpenSSL_FOUND) find_package(OpenSSL REQUIRED) endif() +# libcurl (required by autolykos2 vendored code) +find_package(CURL QUIET) +if(NOT CURL_FOUND) + message(STATUS "libcurl not found on system; attempting to fetch/build via FetchContent") + FetchContent_Declare( + curl + GIT_REPOSITORY https://github.com/curl/curl.git + GIT_TAG curl-8_4_0 + GIT_SHALLOW TRUE + ) + # Try to make it available (this will add_subdirectory if curl provides CMake) + FetchContent_MakeAvailable(curl) +endif() + # secp256k1 (Bitcoin Core library) find_package(PkgConfig QUIET) if(PkgConfig_FOUND) @@ -145,11 +159,24 @@ if(SKALACOIN_ENABLE_AUTOLYKOS2_REF) $<$:/FIstdlib.h> ) endif() + if(TARGET CURL::libcurl) + set(_AUTOLYKOS2_CURL_LIB CURL::libcurl) + elseif(DEFINED CURL_LIBRARIES AND CURL_LIBRARIES) + set(_AUTOLYKOS2_CURL_LIB ${CURL_LIBRARIES}) + else() + set(_AUTOLYKOS2_CURL_LIB "") + endif() + target_link_libraries(autolykos2_ref PRIVATE ${CMAKE_THREAD_LIBS_INIT} OpenSSL::SSL OpenSSL::Crypto + $<$:$_AUTOLYKOS2_CURL_LIB> ) + + if(NOT _AUTOLYKOS2_CURL_LIB) + message(FATAL_ERROR "autolykos2_ref requires libcurl (curl/curl.h). Install libcurl devel package or allow FetchContent to build it.") + endif() set(SKALACOIN_AUTOLYKOS2_REF_AVAILABLE ON) endif()