I am trying to include libcurl in my large c++ project, which I am building on Ubuntu 24.04 using Visual Studio Code, CMake, and gcc.
I downloaded and built libcurl separately and have placed the libcurl folder, along with the built liburl.so (and so.4 and so.4.8.0 files) in my project dir/Engine/lib/curl.
I have added this to the gcc command:
-L/home/ian/dev/hedgey/Engine/lib/curl/ -llibcurl
But I get this error:
[build] /usr/bin/ld.gold: error: cannot find -llibcurl
And just to sanity check my spelling, the output of ls on that dir:
ls /home/ian/dev/hedgey/Engine/lib/curl/libcurl*
/home/ian/dev/hedgey/Engine/lib/curl/libcurl.pc
/home/ian/dev/hedgey/Engine/lib/curl/libcurl.pc.in
/home/ian/dev/hedgey/Engine/lib/curl/libcurl.so
/home/ian/dev/hedgey/Engine/lib/curl/libcurl.so.4
/home/ian/dev/hedgey/Engine/lib/curl/libcurl.so.4.8.0
What am I doing wrong?
EDIT
Due to comments I am attempting to include libcurl using a more “cmakonic” method:
add_subdirectory( ${libDir}/curl ${CMAKE_CURRENT_BINARY_DIR}/curl)
target_link_libraries(${TORQUE_APP_NAME} curl)
addInclude(${libDir}/curl/src)
And I get the following error:
CMake Error at Tools/CMake/torque3d.cmake:606 (target_link_libraries):
Target “curl” of type EXECUTABLE may not be linked into another target.
One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
EDIT
I have replaced the target_link_libraries with:
target_link_libraries(${TORQUE_APP_NAME} libcurl)
And I now get the rather inscrutable error:
[cmake] CMake Error:
[cmake] Running
[cmake]
[cmake] '/usr/bin/ninja' '-C' '/home/ian/dev/hedgey/build' '-t' 'recompact'
[cmake]
[cmake] failed with:
[cmake]
[cmake] ninja: error: build.ninja:25157: multiple rules generate /home/ian/dev/hedgey/My Projects/hedge/game/resolve
9