diff options
| author | Adam <Adam@Anope.org> | 2010-06-25 20:00:21 -0400 |
|---|---|---|
| committer | Adam <Adam@Anope.org> | 2010-06-25 20:00:21 -0400 |
| commit | 03fbc7d281f5039a97c851970dea3cd8cfaefd64 (patch) | |
| tree | c527046a41b97751b1a52ba7046e36337f0d0373 /CMakeLists.txt | |
| parent | cbcead4e89b3dc0dfb236fff9cb3e62b1b0707c0 (diff) | |
Changed the versioning system to use git
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aabbc4fc7..702aad6a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -366,8 +366,8 @@ else(INSTDIR) endif(INSTDIR) # Version number processing -# Find all lines in version.log that start with VERSION_ -read_from_file(${Anope_SOURCE_DIR}/version.log "^VERSION_" VERSIONS) +# Find all lines in src/version.sh that start with VERSION_ +read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS) # Iterate through the strings found foreach(VERSION_STR ${VERSIONS}) # Get the length of the string @@ -382,6 +382,25 @@ foreach(VERSION_STR ${VERSIONS}) set(VERSION_${VERSION_TYPE} ${VERSION}) endforeach(VERSION_STR ${VERSIONS}) +# Default build version to 0 +set(VERSION_BUILD 0) + +# Only change the build number if version.h exists +if(EXISTS "${Anope_SOURCE_DIR}/include/version.h") + # Attempt to read the build number from include/version.h + read_from_file(${Anope_SOURCE_DIR}/include/version.h "^#define VERSION_BUILD" VERSIONS) + foreach(VERSION_STR ${VERSIONS}) + # Get the length of the string + string(LENGTH ${VERSION_STR} VERSION_LEN) + # Subtract 22 from the string's length + math(EXPR VERSION_NUM_LEN "${VERSION_LEN} - 22") + # Extract the value from the string + string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION) + # Set VERSION_BUILD correctly + set(VERSION_BUILD ${VERSION}) + endforeach(VERSION_STR ${VERSIONS}) +endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h") + # Set the version variables based on what was found above set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}") set(VERSION_DOTTED_NOBUILD "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") |
