[host] windows: add version resource

This allows friendly names and versions to be displayed in task manager
and other applications.
This commit is contained in:
Quantum
2021-07-20 21:00:29 -04:00
committed by Geoffrey McRae
parent 80bc9604ba
commit 3400c2c141
3 changed files with 45 additions and 1 deletions

View File

@@ -16,6 +16,11 @@ endif()
string(STRIP "${GIT_REV}" GIT_VERSION)
set(BUILD_VERSION "const char * BUILD_VERSION = \"${GIT_VERSION}\";")
string(TIMESTAMP YEAR "%Y")
set(HEADER "\
#define LG_VERSION_STR \"${GIT_VERSION}\"\n\
#define LG_CURRENT_YEAR ${YEAR}\n")
if(EXISTS "${CMAKE_BINARY_DIR}/version.c")
file(READ ${CMAKE_BINARY_DIR}/version.c BUILD_VERSION_)
else()
@@ -25,4 +30,5 @@ endif()
if (NOT "${BUILD_VERSION}" STREQUAL "${BUILD_VERSION_}")
file(WRITE ${CMAKE_BINARY_DIR}/version.c "${BUILD_VERSION}")
file(WRITE ${CMAKE_BINARY_DIR}/VERSION "${GIT_VERSION}")
file(WRITE ${CMAKE_BINARY_DIR}/include/version.h "${HEADER}")
endif()