Closed Charlinho97 closed 1 month ago
Welcome @Charlinho97. Ist there a reason you are including cpr this way in your CMake Project?
If you want a minimal working example, take a Look at this one: https://github.com/libcpr/example-cmake-fetch-content
It uses CMake fetch_content
to get cpr included inside your project.
@COM8 I'm a noob in C++ and Cmake, so I started to learn about Web Scrap following a guide from the internet. It gave some files prepared just to introduce the content.
I tried to rebuild the CMakeLists.txt file to match my actual project using the example you gave me, but it isn't working. May you try to help me a bit more? It's being my 1st contact with Cmake stuff, so I can't go too far with it right now.
I just want to setup the initial environment to "have fun" learning new treats...
@Charlinho97 If you link me a repo, I can try to have a look at it :)
I'm learning about web scraping and started to write a code, but the library cpr it's not being recognized. I added a couple print screens of the directories, I hope you guys can help me.
Thank you guys!
WebScraper.cpp
include
include "cpr/cpr.h"
include "libxml/HTMLparser.h"
include "libxml/xpath.h"
int main() {
cpr::Response response = cpr::Get(cpr::Url{"https://www.google.com/finance/"});
return 0; }
_CMakeLists.txt cmake_minimum_required(VERSION 3.5.0) project(WebScraping VERSION 0.1.0)
INCLUDE_DIRECTORIES( C:/Git/Dev/vcpkg/installed/x64-windows/include )
LINK_DIRECTORIES( C:/Git/Dev/vcpkg/installed/x64-windows/lib )
add_executable(WebScraping WebScraper.cpp) target_compile_features(WebScraping PRIVATE cxx_std_20)
find_package(cpr CONFIG REQUIRED) target_link_libraries(WebScraping PRIVATE cpr::cpr)
find_package(LibXml2 REQUIRED) target_linklibraries(WebScraping PRIVATE LibXml2::LibXml2)