Move version out to a version.txt file

This commit is contained in:
Geoff McLane 2015-01-29 18:25:57 +01:00
parent 0eb1407818
commit e2cbd9e89f
2 changed files with 15 additions and 8 deletions

View file

@ -3,11 +3,17 @@ cmake_minimum_required (VERSION 2.8)
project (tidy5) project (tidy5)
# ### NOTE: *** Adjust when required *** # ### NOTE: *** Adjust version.txt when required ***
set( TIDY_MAJOR_VERSION 4 ) # read 'version' file into a variable (stripping any newlines or spaces)
set( TIDY_MINOR_VERSION 9 ) file(READ version.txt versionFile)
set( TIDY_MICRO_VERSION 1 ) # adjust this for each change if (NOT versionFile)
set( LIBTIDY_VERSION "${TIDY_MAJOR_VERSION}.${TIDY_MINOR_VERSION}.${TIDY_MICRO_VERSION}" ) message(FATAL_ERROR "Unable to determine libtidy version. version.txt file is missing.")
endif()
string(STRIP "${versionFile}" LIBTIDY_VERSION)
string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION})
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
list(GET VERSION_LIST 1 TIDY_MINOR_VERSION)
list(GET VERSION_LIST 2 TIDY_POINT_VERSION)
# establish version date # establish version date
set( tidy_YEAR 2015 ) set( tidy_YEAR 2015 )
@ -67,13 +73,13 @@ add_definitions ( -DSUPPORT_UTF16_ENCODINGS=1 )
add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 ) add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 )
add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 ) add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 )
add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" ) add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" )
add_definitions ( -DLIBTIDY_VERSION="${TIDY_MAJOR_VERSION}.${TIDY_MINOR_VERSION}.${TIDY_MICRO_VERSION}" ) add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )
if(BUILD_SHARED_LIB) if(BUILD_SHARED_LIB)
set(LIB_TYPE SHARED) set(LIB_TYPE SHARED)
message("*** Building DLL library ${LIB_TYPE}") message("*** Building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}")
else(BUILD_SHARED_LIB) else(BUILD_SHARED_LIB)
message("*** Building static library ${LIB_TYPE}") message("*** Building static library ${LIB_TYPE}, version ${LIBTIDY_VERSION}")
endif(BUILD_SHARED_LIB) endif(BUILD_SHARED_LIB)
include_directories ( "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" ) include_directories ( "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" )

1
version.txt Normal file
View file

@ -0,0 +1 @@
4.9.2