[CMake] example for advanced dashboard reporting
th.tom at gmx.de
th.tom at gmx.de
Thu Nov 5 07:59:53 EST 2009
> How about something like this (not tested):
>
> SET (CTEST_BUILD_NAME
> "${CTEST_PROJECT_NAME}-${CMAKE_SYSTEM}-${CTEST_CMAKE_GENERATOR}")
>
Hm ..
I am actually working on something more specific (see below). But as usual: I grep it from the net and it does not work :-(.
"hostname" is found, "date" and "time" is not found under windows even if it is available on the command line - very strange!?
---
find_program ( HOSTNAME_CMD NAMES hostname )
exec_program ( ${HOSTNAME_CMD} OUTPUT_VARIABLE HOSTNAME )
SET ( OSNAME "unknow" )
IF ( WIN32 )
SET ( OSNAME "win32" )
ENDIF ( WIN32 )
IF ( "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" )
SET ( OSNAME "SunOS" )
ENDIF ( "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" )
IF ( "${CMAKE_SYSTEM_NAME}" MATCHES "linux" )
SET ( OSNAME "linux" )
ENDIF ( "${CMAKE_SYSTEM_NAME}" MATCHES "linux" )
MESSAGE ( "Creating Build for ${OSNAME} on host ${HOSTNAME} and ${PROJECT_NAME}" )
find_program ( DATE_CMD NAMES date )
MACRO (TODAY RESULT)
SET ( PR_DATE )
IF (WIN32)
find_program ( TIME_CMD NAMES time )
IF ( NOT DATE_CMD OR NOT TIME_CMD )
MESSAGE ( " No date or time command found" )
SET(${RESULT} 000000)
ELSE ( NOT DATE_CMD OR NOT TIME_CMD )
exec_program ( ${DATE_CMD} "/T" OUTPUT_VARIABLE PR_DATE )
exec_program ( ${TIME_CMD} "/T" OUTPUT_VARIABLE PR_TIME )
string(REGEX REPLACE "\\." "" ${RESULT} "${PR_DATE}${PR_TIME}")
MESSAGE ( "WINDOWS RESULT: ${RESULT} from ${PR_DATE}${PR_TIME}")
ENDIF ( NOT DATE_CMD OR NOT TIME_CMD )
ELSEIF(UNIX)
exec_program ( ${DATE_CMD} ARGS "+%d%m%Y%H%M" OUTPUT_VARIABLE RESULT)
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} 000000)
ENDIF (WIN32)
ENDMACRO (TODAY RESULT)
SET ( DATE )
TODAY ( DATE )
set( CTEST_BUILD_NAME "${PROJECT_NAME}-${HOSTNAME}-${OSNAME}-${DATE}" )
MESSAGE ( "Build ID is ${CTEST_BUILD_NAME}" )
More information about the CMake
mailing list