I have the following code for fetching and linking against the Curl library:
include(FetchContent)
FetchContent_Declare(curl
GIT_REPOSITORY "https://github.com/curl/curl.git"
GIT_TAG "curl-8_6_0"
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(curl)
target_link_libraries(${EXECUTABLE_NAME} PRIVATE CURL::libcurl)
The code functions correctly, but whenever I attempt to run my final executable build outside of my Integrated Development Environment (IDE), I encounter “DLL not found” errors. I’m interested in learning how I can instruct Curl to link statically so that I don’t have to deal with trying to find and copy DLL files.
PS: I did also tried the following command:
add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:exe> $<TARGET_FILE_DIR:exe>
COMMAND_EXPAND_LISTS)
This command works just fine for copying the DLL files, but I still get DLL not found errors. My guess is that Curl internally depends on some other things that are not being copied.