execute_process(COMMAND git describe --tags --always --dirty WORKING_DIRECTORY ${SRC} OUTPUT_VARIABLE V OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) if(NOT V) set(V "0.0.0-dev") endif() string(REGEX REPLACE "^v" "" V "${V}") string(SUBSTRING "${V}" 0 15 V) set(CONTENT "#define NINLIGHT_FW_VERSION \"${V}\"\n") if(EXISTS ${OUT}) file(READ ${OUT} OLD) else() set(OLD "") endif() if(NOT OLD STREQUAL CONTENT) file(WRITE ${OUT} "${CONTENT}") endif()