2009/2/12 Benoit <[email protected]>:
> 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})

[...]

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

I think your example should work since this one is working fine:

MACRO (TODAY RESULT)
    EXECUTE_PROCESS(COMMAND echo "MacroSetted" OUTPUT_VARIABLE ${RESULT})
    MESSAGE( STATUS "(in) ${RESULT}")
ENDMACRO (TODAY)

TODAY(FF)
MESSAGE(STATUS "FF = ${FF}")

I think perl execution is behaving strangely when executed from within
execute_process.
I would bet that when executed interactively in a termibnal it works as expected
but does not behave the same way regarding standard output when launch in exec.

-- 
Erk
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to