ews-cpp icon indicating copy to clipboard operation
ews-cpp copied to clipboard

README: update 'libcurl on Windows' section

Open bkircher opened this issue 8 years ago • 7 comments

One can easily build libcurl on Windows from source (with https://gitlab.com/benjamin.kircher/curl-winbuild for example) and I believe a recent Windows 10 comes now with curl bundled (no idea about libcurl, though).

Investigate and update README.md accordingly.

bkircher avatar Jan 03 '18 13:01 bkircher

See: curl on Windows.

The confusedbycode.com/curl hint should be removed from the README section, IMO.

bkircher avatar Jan 03 '18 13:01 bkircher

IMO we can just create normal package with Conan and drop support for so strange way to deliver Curl on Windows

zamazan4ik avatar May 03 '19 15:05 zamazan4ik

Excellent idea! Definitely willing to merge (unfortunately I have no Windows environment for testing anymore. But I guess we find somebody who has).

bkircher avatar May 03 '19 15:05 bkircher

Ok. Locally I just wrote conanfile.py. Quality is a little bit prototypish :) I use libcurl from from Conan. Can I also switch to rapidxml from Conan instead of built-in one?

Another annoying issue - there are no options in current version of CMakeLists to disable building examples and/or tests.

zamazan4ik avatar May 03 '19 17:05 zamazan4ik

Can I also switch to rapidxml from Conan instead of built-in one?

That won't work I guess. The build in one is heavily patched to support (to some extend) XML namespaces.

Another annoying issue - there are no options in current version of CMakeLists to disable building examples and/or tests.

Good point. I created a ticket #147 for this. (And as always, PRs always welcome 😄 )

bkircher avatar May 03 '19 19:05 bkircher

Btw, which libcurl version is required? Cannot find libcurl which will compile successfully with ews-cpp on Fedora 30 (trying different versions with Conan). Every time get smth like this:

In file included from /home/zamazan4ik/OpenSource/ews_cpp_poc/main.cpp:1:
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:8235:74: error: too many arguments provided to function-like macro invocation
            auto retcode = curl_easy_setopt(handle_.get(), option, arg1, arg2);
                                                                         ^
/home/zamazan4ik/.conan/data/libcurl/7.50.3/bincrafters/stable/package/e8a4f36e9466788262927d466c3366a18c0ab134/include/curl/curl.h:2443:9: note: macro
      'curl_easy_setopt' defined here
#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
        ^
In file included from /home/zamazan4ik/OpenSource/ews_cpp_poc/main.cpp:1:
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:8236:13: error: statement requires expression of integer type
      ('CURLcode (*)(void *, CURLoption, ...)' invalid)
            switch (retcode)
            ^       ~~~~~~~
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:8243:23: error: no matching function for call to 'make_curl_error'
                throw make_curl_error("curl_easy_setopt: unsupported option",
                      ^~~~~~~~~~~~~~~
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:7680:23: note: candidate function not viable: no known conversion from
      'CURLcode (*)(void *, CURLoption, ...)' to 'CURLcode' for 2nd argument
    inline curl_error make_curl_error(const std::string& msg, CURLcode rescode)
                      ^
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:8249:23: error: no matching function for call to 'make_curl_error'
                throw make_curl_error("curl_easy_setopt: failed setting option",
                      ^~~~~~~~~~~~~~~
/home/zamazan4ik/OpenSource/ews_cpp_poc/include/ews/ews.hpp:7680:23: note: candidate function not viable: no known conversion from
      'CURLcode (*)(void *, CURLoption, ...)' to 'CURLcode' for 2nd argument
    inline curl_error make_curl_error(const std::string& msg, CURLcode rescode)

zamazan4ik avatar May 04 '19 21:05 zamazan4ik

Btw, which libcurl version is required?

7.29 is required. Your version is absolutely fine.

The issue you have is that you don't have the feature test macros enabled for you build.

In this case the error might go away if you manually define

#define EWS_HAS_VARIADIC_TEMPLATES 1

before including ews.hpp header.

Take a look at the feature test macros in CMakeLists.txt to see all tests. Note that you don't need to use CMake to build your project. You can record the results of the CMake tests and then manually define the macros for your compiler/standard library in an intermediate header file.

Something like

#ifndef _WIN32
#define EWS_HAS_VARIADIC_TEMPLATES 1
#endif
#ifndef NDEBUG
#define EWS_DISABLE_TLS_CERT_VERIFICATION 1
#endif

// and so on… now include ews.hpp

#include "ews/ews.hpp"
#include "ews/ews_version.hpp"

bkircher avatar May 05 '19 19:05 bkircher