Для относительно недавних версий CMake (> = 2.8.11):
string (TIMESTAMP {output variable} [{format string}] [UTC])
(см. [д0] http://www.cmake.org/cmake/help/v3.0/command/string.html [/ д0]). Например, STRING (TIMESTAMP TODAY "% Y% m% d")