curl-library
Re: Some fixes for cmake build.
Date: Tue, 30 Mar 2010 12:08:04 +0400
* Bill Hoffman <bill.hoffman_at_kitware.com> [Mon, 29 Mar 2010 23:05:12
-0400]:
> I guess my question was directed at "Tetetest" who provided the patch.
> If he could try git master, and it works for him, then there should be
> no need for the patch.
Bill,
First of all, thanks for the excellent job you did! Your patch fixes
most of the problems.
You even handle the situation when libldap is present, but ldap.h is
absent, and you
do it elegantly.
Still, there are a couple of problems still to be fixed, and I am
working on them now.
1. (fixed) Problem with curlbuild.h: when building in-source, it is not
refreshed by CMake;
when building out-of-source, curl/curl.h includes the wrong
'curlbuild.h' file. The solution
is simple: remove the file that comes with distribution prior to
generating the new one.
Thanks to Yang Tse for clarifying on this issue.
2. (well, somewhat fixed) Problem with CURL_PULL_*_H definitions that
are never set in
CMake build. As the result, no headers are included by curlbuild.h,
which causes
compile errors on OpenSolaris. My solution is simple, straightforward,
and perhaps
dumb: if the header is present in the system, it is pulled. Not quite
smart, but it works.
3. The problem I am trying to tackle now: windows.h, winsock2.h and
socklen_t.
Here is it:
- When using MS Visual Stuidio 2008 compiler, 'socklen_t' is detected in
header file
w32tcpip.h. So it is logical to pull this header (and winsock2.h) into
culrbuild.h.
- Here comes the problem: VS2008 does not allow simultaneous inclusion
of
winsock.h and winsock2.h. If you do so, you will see a long list of
error messages
about incompatible DLL linkage specifications, redefined macros and the
like.
By default, windows.h includes winsock.h (unless you define
WIN32_LEAN_AND_MEAN).
If you then include winsock2.h, you are doomed (rumours say it works
when you include
winsock2.h first, but I did not bother to test).
Almost all windows applications include windows.h. We cannot guarantee
that
curl/curl.h is included before windows.h. We cannot demand that
WIN32_LEAN_AND_MEAN
be defined for all the applications that use libcurl. Also, tricks like
this don't work:
curlbuild.h:
#ifdef CURL_PULL_WS2TCPIP_H
/* Yes, we define the magic here, but what if windows.h has already been
included? */
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
#endif
It looks like the only "truly VS2008-compatible" solution is to fall
back to 'int'(pretending we didn't find socklen_t). Sounds disgusting.
So, I am a bit stuck. Can anybody give me a piece of advice?
-- Best regards.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-30