Adding versions to cmake

This commit is contained in:
Daniel Lemire 2019-03-04 15:40:52 -05:00
parent 693b45c561
commit 6541682433
2 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,9 @@ endif()
project(simdjson) project(simdjson)
set(SIMDJSON_LIB_NAME simdjson) set(SIMDJSON_LIB_NAME simdjson)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 1)
set(SIMDJSON_LIB_VERSION "0.0.1" CACHE STRING "simdjson library version") set(SIMDJSON_LIB_VERSION "0.0.1" CACHE STRING "simdjson library version")
set(SIMDJSON_LIB_SOVERSION "0" CACHE STRING "simdjson library soversion") set(SIMDJSON_LIB_SOVERSION "0" CACHE STRING "simdjson library soversion")

View File

@ -100,13 +100,22 @@ import fileinput
import re import re
newmajorversionstring = str(newversion[0]) newmajorversionstring = str(newversion[0])
mewminorversionstring = str(newversion[1])
newrevversionstring = str(newversion[2])
newversionstring = str(newversion[0]) + "." + str(newversion[1]) + "." + str(newversion[2]) newversionstring = str(newversion[0]) + "." + str(newversion[1]) + "." + str(newversion[2])
cmakefile = maindir + os.sep + "CMakeLists.txt" cmakefile = maindir + os.sep + "CMakeLists.txt"
for line in fileinput.input(cmakefile, inplace=1, backup='.bak'): for line in fileinput.input(cmakefile, inplace=1, backup='.bak'):
line = re.sub('SIMDJSON_LIB_VERSION "\d+\.\d+\.\d+','SIMDJSON_LIB_VERSION "'+newversionstring, line.rstrip()) line = re.sub('SIMDJSON_LIB_VERSION "\d+\.\d+\.\d+','SIMDJSON_LIB_VERSION "'+newversionstring, line.rstrip())
line = re.sub('SIMDJSON_LIB_SOVERSION "\d+','SIMDJSON_LIB_SOVERSION "'+newmajorversionstring, line) line = re.sub('SIMDJSON_LIB_SOVERSION "\d+','SIMDJSON_LIB_SOVERSION "'+newmajorversionstring, line)
line = re.sub('set(PROJECT_VERSION_MAJOR \d+','set(PROJECT_VERSION_MAJOR '+newmajorversionstring, line)
line = re.sub('set(PROJECT_VERSION_MINOR \d+','set(PROJECT_VERSION_MINOR '+mewminorversionstring, line)
line = re.sub('set(PROJECT_VERSION_PATCH \d+','set(PROJECT_VERSION_PATCH '+newrevversionstring, line)
print(line) print(line)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 1)
print("modified "+cmakefile+", a backup was made") print("modified "+cmakefile+", a backup was made")
scriptlocation = os.path.dirname(os.path.abspath(__file__)) scriptlocation = os.path.dirname(os.path.abspath(__file__))