On Wed, 10 Jun 2009 09:39:28 +0300
Cosmin Luţă <[email protected]> wrote:

> On Tue, 09 Jun 2009 14:42:14 -0400
> Bill Hoffman <[email protected]> wrote:
> 
> > Cosmin Luţă wrote:
> > 
> > >>
> > >> The autotools does this:
> > >>
> > >> arg1 in int SOCKET;
> > >>    arg2 in 'struct sockaddr' void;
> > >>      t in socklen_t int size_t 'unsigned int' long 'unsigned
> > >> long' void; extern int FUNCALLCONV getpeername($arg1, $arg2 *,
> > >> $t *);
> > >>
> > >> I guess I should do the same for CMake?
> > >>
> > > 
> > > I've see something similar in CMake/OtherTests.cmake for
> > > determining the arg and ret types of send()/recv(); perhaps you
> > > could do the same? 
> > > 
> > > 
> > 
> > Yes, I could.  Seems a bit brute force.   Is there no other way to
> > find this?  We are looking for $t but vary arg1 and arg2.   Seems
> > like there should be a better way to figure this out.
> > 
> > -Bill
> 
> Bruteforcing seems the best way to me if you want to have the most
> flexibility (i.e. deploy on any platform and have minimum
> trouble)... I can't even think of another easy method of detecting
> this. Besides, you said yourself that autotools do a similar thing,
> no?
> 

By the way, offtopic, but CMake related. 
I have this code which reads curlver.h and extracts the version from
it, perhaps you could use it (I suppose you're maintaining the CMake
files..)

file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS)
string (REGEX MATCH "LIBCURL_VERSION_MAJOR[ \t]+([0-9]+)" LIBCURL_VERSION_MJ ${CURL_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_MJ ${LIBCURL_VERSION_MJ})
string (REGEX MATCH "LIBCURL_VERSION_MINOR[ \t]+([0-9]+)" LIBCURL_VERSION_MI ${CURL_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_MI ${LIBCURL_VERSION_MI})
string (REGEX MATCH "LIBCURL_VERSION_PATCH[ \t]+([0-9]+)" LIBCURL_VERSION_PT ${CURL_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_PT ${LIBCURL_VERSION_PT})
set (CURL_MAJOR_VERSION ${LIBCURL_VERSION_MJ})
set (CURL_MINOR_VERSION ${LIBCURL_VERSION_MI})
set (CURL_PATCH_VERSION ${LIBCURL_VERSION_PT})

Reply via email to