Include self-contained static libcurl

From recent experience, the developer has to be careful about including libcurl as it has many dependencies. Accordingly, I built it into my app so all dependencies are included in the final build.

$ brew install curl-openssl

$ brew remove curl

$ ./configure –disable-shared –enable-static –prefix=/usr/local/lib/curl –disable-shared –enable-static –disable-ldap –disable-sspi –without-librtmp –disable-ftp –disable-file –disable-dict –disable-telnet –disable-tftp –disable-rtsp –disable-pop3 –disable-imap –disable-smtp –disable-gopher –disable-smb –without-libidn –with-openssl=/usr/local/Cellar/openssl@1.1/1.1.1k

$ curl-config –static-libs

Add CURL_STATICLIB in the Preprocessor Definitions of your C++ project. Add all the libs listed by –static-libs with the correct path into your project.

In Windows, use vcpkg to install the static versions and add CURL_STATICLIB to preprocessor defines.

References –


Software Engineer, Dancer and Filmmaker. Currently rebooting his life.

Leave a Reply