subsurface/cmake/Modules/HandleVersionGeneration.cmake
Dirk Hohndel 62477d8c65 Complete redesign of Subsurface version numbers
- for now all versions start with v6.0
- CICD builds use the monolithic build number as patch level, e.g. v6.0.12345
- local builds use the following algorithm
  - find the newest commit with a CICD build number that is included in the
    working tree
  - count the number of commits in the working tree since that commit
  - if there are no commits since the last CICD build, the local build version
    will be v6.0.12345-local
  - if there are N commits since the last CICD build, it will be
    v6.0.12345-N-local
- test builds in the CICD that don't create artifacts simply use a dummy release
  in order to not incorrectly increment the build number and also not to waste
  time and resources by manually checking out the nightly-build repo for each of
  these builds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00

18 lines
606 B
CMake

# Generate the ssrf-config.h every 'make'
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
"#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
#define CANONICAL_VERSION_STRING_4 \"@CANONICAL_VERSION_STRING_4@\"
")
file(COPY cmake/Modules/version.cmake
DESTINATION ${CMAKE_BINARY_DIR})
add_custom_target(
version ALL COMMAND ${CMAKE_COMMAND}
-D SRC=${CMAKE_BINARY_DIR}/version.h.in
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
-D CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-D CMAKE_TOP_SRC_DIR=${CMAKE_SOURCE_DIR}
-D CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
-P ${CMAKE_BINARY_DIR}/version.cmake
)