[CMake] Cmake macro and date

Benoit benpaka.spam at gmail.com
Thu Feb 12 07:53:30 EST 2009


Hy,

I want to retrieve today date in order to install various release each day.
I've created a script: GetDataTime.cmake

In which I have defined this macro:

INCLUDE(FindPerl)
MACRO (TODAY RESULT)
IF (PERL_FOUND)
    EXECUTE_PROCESS(COMMAND "${PERL_EXECUTABLE}" "-E
'($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
printf \"%02d%02d%02d\",$year-100,$mon+1,$mday;'" OUTPUT_VARIABLE ${RESULT})
    MESSAGE( STATUS "(in) ${RESULT}")
ELSE (PERL_FOUND)
          MESSAGE(SEND_ERROR "Perl needed to obtain today date")
ENDIF(PERL_FOUND)
ENDMACRO (TODAY)

Then in the CMakeList.txt I have call
INCLUDE(GetTime)
TODAY(VAR)
MESSAGE( STATUS "TODAY is ${VAR}")


When i call the makefile I have:
-- (in) VAR
-- Correctly setted


Someone can tell me how to use a macro to retrieve a result because I'm not
sure to understand!!!!


--
Benoit RAT
www.neub.co.nr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090212/f14b3e58/attachment.htm>


More information about the CMake mailing list