cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1292 CMake configuration option broken on all non-Windows platforms + Patch

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Sun, 20 Oct 2013 15:43:36 +0000

Thanks a lot, patch merged and pushed!

---
** [bugs:#1292] CMake configuration option broken on all non-Windows platforms + Patch**
**Status:** closed-fixed
**Created:** Sun Oct 20, 2013 02:56 PM UTC by Oliver Kuckertz
**Last Updated:** Sun Oct 20, 2013 02:56 PM UTC
**Owner:** Daniel Stenberg
Hello,
I am using libcurl 7.33.0 on Mac OS X 10.8.5. I was previously using CMake for configuring libcurl on Windows and tried to use the same configuration path on OS X. I however ran into an issue with the configuration process caused by curlbuild.h.cmake:
Line 140 to 160 of said file contains the following code:
    /* on windows socklen_t is in here */
    #ifdef _WIN32
    #  include <winsock2.h>
    #  include <ws2tcpip.h>
    #endif
    
    #ifdef HAVE_SYS_SOCKET_H
    #  include <sys/socket.h>
    #endif
    
    /* Data type definition of curl_socklen_t. */
    typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
    
    ...snip...
    
    /* Data type definition of curl_off_t. */
    typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
The macro _WIN32 is always defined by MSVC, which is why compiling with CMake worked on Windows platforms. HAVE_SYS_SOCKET_H however is defined by curl_setup.h, generated by CMake during the configuration phase.
Using the header curlbuild.h (which is included at the top of curl.h) works fine as long as curl_setup.h has been included before curl.h, which is the case with all internal tools and tests used by curl. However, once the resulting files are installed into the given prefix path, curl_setup.h and therefore HAVE_SYS_SOCKET_H is no longer available.
Including curl.h will now fail with the following error:
    $ gcc -o simple curl-7.33.0/docs/examples/simple.c -Igcc-prefix/include gcc-prefix/lib/libcurl.a 
    In file included from gcc-prefix/include/curl/curl.h:34:0,
                     from curl-7.33.0/docs/examples/simple.c:23:
    gcc-prefix/include/curl/curlbuild.h:151:1: error: unknown type name 'socklen_t'
     typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
     ^
Because this issue does not occur with ./configure and thus curlbuild.h.in, and both files should be functionally identical, I squeezed them through diff and brought curlbuild.h.cmake up to speed with its twin.
Attached is a patch which fixes the issue described above, some incorrect usage of #cmakedefine in the same file, and adds CURL_PULL_* definitions used by curlbuild.h to CMakeLists.txt.
Oliver
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2013-10-20

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET