execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
string(REGEX REPLACE "\n" "" BUILD ${BUILD})
elseif(WIN32)
- execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmakescripts/getdate.bat"
- OUTPUT_VARIABLE BUILD)
- string(REGEX REPLACE "\n" "" BUILD ${BUILD})
+ execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE
+ BUILD)
+ string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}")
+ if (BUILD STREQUAL "")
+ execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD)
+ string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}")
+ else()
+ string(SUBSTRING "${BUILD}" 0 8 BUILD)
+ endif()
else()
message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
endif()