Building libcurl with SSL support on Windows

前端 未结 10 2244
眼角桃花
眼角桃花 2020-11-27 12:12

I\'m using libcurl in a Win32 C++ application.

I have the curllib.vcproj project added to my solution and set my other projects to depend on it.

How do I bui

10条回答
  •  爱一瞬间的悲伤
    2020-11-27 12:26

    In my case follow the curl README file was enough.
    My configuration is the following:

    • Visual Studio 2015 (VC14)
    • Static library
    • Win64
    • curl version 7.57.0
    • OpenSSL 1.0.2

    Compilation of libCurl

    1. Download libcurl source there: https://curl.haxx.se/download.html
    2. Uncompress the file and go to the folder curl-7.57.0\projects
    3. Open the README file and follow the instructions, this lead me to do the following:
      • Downloaded OpenSSL
      • Extract it and rename it to openssl, put it aside the curl folder, this is important as you'll open the VS project that expect to find openssl there.
      • Install Perl
      • Execute the utility build-openssl.bat to perform the compilation of openSSL. With my settings this became the following:
        .\build-openssl.bat vc14 x64 release ..\..\openssl\
        just runs .\build-openssl.bat -help to know more about the parameters.
        After that you can see OpenSSL has been compiled as you got a new folder here: openssl\build\Win64
    4. Open the Visual Studio project curl-7.57.0\projects\Windows\VC14\curl-all.sln
    5. Be sure to set the visual studio project to the build configuration you need (LIB Release - LIB OpenSSL in my case)
    6. Build all
    7. The library is located at curl-7.57.0\build\Win64\VC14\LIB Release - LIB OpenSSL\libcurl.lib

    Remarks

    • Don't forget to define the CURL_STATICLIB preprocessor in your own project
    • With static library, you will have to links with the dependencies of libcurl, see this answer
    • You might not want to depend on LDAP, in that case you can disable it by setting the preprocessor CURL_DISABLE_LDAP before you compile libcurl.

提交回复
热议问题