httpclient-cpp
httpclient-cpp copied to clipboard
Building under Windows via Visual Studio
The link provided to the fork of build-libcurl-windows is no longer available ( : https://github.com/ribtoks/build-libcurl-windows )
How would one build libcurl under Visual Studio 2017 as per the requirements of this project without the aforementioned git repo?
Please can you provide an updated guide for Windows Users wishing to include your HttpClient in their C++ appliations?
Many thanks in advance!
Hi,
I recommend you to use vcpkg https://github.com/microsoft/vcpkg and even in your other VS projects.
In another repo, I wrote instructions related to vcpkg : https://github.com/embeddedmz/ftpclient-cpp
Best regards.
I have to fix the CMakeLists.txt files, I'm working on it right now.
Brilliant! Thank you for the fast response. I have recently started using vcpkg but I wasn't sure how to use it to install this project. I'll take a look at your instructions for the ftpclient and see if I can figure it out!
Will I need to wait for you to fix the CMakeLists.txt files before it will work with vcpkg or is that just if I try building it from source?
Thanks again for the help!
Followed your steps as per your instructions on your other repo and seems to have worked as I buit all_build and it said it was successful but I don't think I'm sure how to use this in my project?
if I #include "HTTPClient.h"
I just get an error saying it can't open the source file so I presume I haven't finished the install properly?
You have also a CMake option SKIP_TESTS_BUILD that you can set to false to have a unit test project in the solution generated by CMake... You can set that project as the startup project, indicate a path to an INI configuration file (read the README) and launch the unit tests program to check if everything is OK (tests using HTTPS might fail if curl[openssl] is not installed with vcpkg).
If you want to use the class in a project you have 2 options :
- use the 2 header files and the generated static library in your application (copy also libcurl DLLs that have been copied in the build output directory by vcpkg/Visual Studio).
- if your project already uses CMake, I think you can use the add_subdirectory (and maybe include_directories too if the scripts I have written are not compliant with the modern way of writing CMake scripts) to tell CMake to include httpclient-cpp to your future solution and then tell CMake to link your application to the library with target_link_libraries (With TestHTTP, the unit tests program of this class, you can see the I made the link with target_link_libraries(test_httpclient httpclient gtest ${CURL_LIBRARIES})
Otherwise, you can add all the files under the HTTP directory (HTTPClient and CurlHandle classes) in your VS C++ project and it should work too since you are using vcpkg (you must enable integration in VS before).