chore: Do not generate source files and use target_compile_definition… (#2369)

…s to set version

Advantages:
- not modifying src dir in build time (`git clean` will also remove
less)
- simpler codecov (if we decide to move it to separate stage in the
future)
- The cpp file is perfectly valid, so it will be treated as a C++ files
by all the tooling
- No need to use CMAKE_PROJECT_INCLUDE_BEFORE, should work fine without
it
- Instead of generating + recompiling, we will just be doing
recompilation of 1 file
This commit is contained in:
Ayaz Salikhov
2025-07-28 12:49:36 +01:00
committed by GitHub
parent 4a4f8842bd
commit 0e2ba4a64e
7 changed files with 15 additions and 14 deletions

View File

@@ -1,7 +1,3 @@
#[===================================================================[
write version to source
#]===================================================================]
find_package(Git REQUIRED)
set(GIT_COMMAND describe --tags --exact-match)
@@ -47,5 +43,3 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
endif ()
message(STATUS "Build version: ${CLIO_VERSION}")
configure_file(${CMAKE_CURRENT_LIST_DIR}/Build.cpp.in ${CMAKE_CURRENT_LIST_DIR}/../src/util/build/Build.cpp)