mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Implement lazy-loaded libcurl
- Uses `dlopen` to load libcurl at runtime for better portability. - Replaces the FETCH_AVAILABLE macro with download_available() check. - Provides descriptive error messages when libcurl is missing.
This commit is contained in:
committed by
Christoffer Lerno
parent
c5d7a03859
commit
de8a733c77
@@ -129,9 +129,6 @@ if(C3_USE_MIMALLOC)
|
||||
)
|
||||
FetchContent_MakeAvailable(mimalloc)
|
||||
endif()
|
||||
if (NOT WIN32)
|
||||
find_package(CURL)
|
||||
endif()
|
||||
|
||||
find_package(Git QUIET)
|
||||
if(C3_USE_TB AND GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
@@ -606,12 +603,11 @@ if(MINGW)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,8388608")
|
||||
endif ()
|
||||
|
||||
if (CURL_FOUND)
|
||||
target_link_libraries(c3c ${CURL_LIBRARIES})
|
||||
target_include_directories(c3c PRIVATE ${CURL_INCLUDE_DIRS})
|
||||
target_compile_definitions(c3c PUBLIC CURL_FOUND=1)
|
||||
else()
|
||||
target_compile_definitions(c3c PUBLIC CURL_FOUND=0)
|
||||
if (NOT WIN32)
|
||||
# For dlopen support
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(c3c ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user