[Freeassociation-devel] 32 bit time_t
Allen Winter
winter at kde.org
Fri Dec 30 05:02:09 PST 2011
On Friday, December 30, 2011 10:52:21 AM Antony Bowesman wrote:
> On 30/12/2011 8:42 AM, Allen Winter wrote:
> > On Thursday 29 December 2011 02:12:59 PM Antony Bowesman wrote:
> >> I'm integrating libical with some old 32 bit s/w, which is built with
> >> _USE_32BIT_TIME_T on Windows. This means any function with time_t in the
> >> interface, e.g. icaltime_from_timet_with_zone() doesn't work using the default
> >> libical build.
> >>
> >> I tried to run Cmake with -D_USE_32BIT_TIME_T=true, but it ignores that param.
> >>
> >> What's the 'right' way to make libical use 32 bit time_t? I modified the vcproj
> >> files, but that's a hack.
> >>
> >> Is it modify cmakelists.txt or something else
> >>
> >> Can it be made configurable about whether Win version is built with 32/64 time_t?
> >>
> > So even if you are using a 32 bit MSVC, time_t is still 64 bits?
> > that seems a little strange.
>
>
> MS changed the default time_t size in Visual Studio 2005 from 32 to 64 bit, so
> the default libical build using
>
> cmake -G "Visual Studio 8 2005"
>
> will make time_t 64 bit. Our app is built with -D_USE_32BIT_TIME_T, so the two
> cannot work together unless I build libical with -D_USE_32BIT_TIME_T.
>
>
> > try this: in the libical/CMakeLists.txt, put the line
> > add_definitions(-D_USE_32BIT_TIME_T=1)
> > somewhere near the top
>
> That works, I wrapped it in
>
> if(WIN32)
> if(MSVC)
> add_definitions(-D_USE_32BIT_TIME_T)
> endif(MSVC)
> endif(WIN32)
>
> and it makes the vcproj files with the correct define, so that's OK, but I guess
> some people will want 32 bit time_t and others will want 64, depends on how they
> are using the library, so it would be good to have it selectable on the CMake
> command line, e.g. with -D_USE_32BIT_TIME_T=true.
>
> I'm not sure how to change CMakeLists.txt to achieve this though.
>
Ok, a possible fix is committed in r1119.
Please try and let me know if this is a satisfactory solution.
cmake --DUSE_32BIT_TIME_T=true
More information about the libical-devel
mailing list