I would like to invoke date +"%s" > ${TIMESTAMP}
for each of the three executables, myapp_data
, myapp_live
and myapp_sim
that I generate (ie only create the timestamp if the respective executables are created).
I can't seem to figure out why my custom command isn't being executed even after I remove the binaries and relink. Build works fine - only the timestamp generation doesn't work.
MACRO( MY_APP TAG )
SET( BINARY_TGT "myapp_${TAG}" )
SET( TIMESTAMP "TIMESTAMP_${TAG}" )
ADD_EXECUTABLE( ${BINARY_TGT} ${APP_SRCS} )
ADD_CUSTOM_COMMAND(
OUTPUT ${TIMESTAMP}
COMMAND date
ARGS +\"%s\" > ${TIMESTAMP}
DEPENDS ${BINARY_TGT}
)
ENDMACRO( MY_APP )
SUBDIRS( data )
SUBDIRS( live )
SUBDIRS( sim )
Inside the data dir, I have:
FILE(GLOB APP_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} main_data.cpp)
SET( MY_TAG data )
MY_APP( "${MY_TAG}" )