Linking to curlcpp (a C++ curl wrapper)

There’s also the “Curl for People” project, which you can find here:

I’ve embedded that into a larger project hierarchy with FetchContent before. I upstreamed a couple of minor patches to enable that to be done cleanly, and they are part of the official releases now, so I’d expect a fairly smooth path.

The problem you are facing with curlcpp is that it wants to bring curl into the build with find_package(), but you are trying to bring curl into the build with FetchContent. There is a feature coming in CMake 3.24 which would allow you to do this cleanly (see MR 5688), but at the moment, this mixture of methods requires some hacking around one or the other to make it work. Basically, you would have to either force the find_package() call to pick up a dummy Findcurl.cmake or curl-config.cmake that you put somewhere, or abandon using FetchContent bringing in curl and require it to be provided by something outside of CMake.

2 Likes