From c94aae7323e5058910096450ce103742eff6cbe0 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 28 Apr 2024 15:14:06 +0100 Subject: [PATCH] Update set_version_number to set version in CMakeLists --- scripts/set_version_number.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/set_version_number.py b/scripts/set_version_number.py index 2f036bb0..c6b55148 100644 --- a/scripts/set_version_number.py +++ b/scripts/set_version_number.py @@ -30,6 +30,13 @@ def update_resource_file(path, version): replace_in_file(path, 'VERSION \\d+, \\d+, \\d+', 'VERSION {}'.format(comma_separated_version)) replace_in_file(path, 'Version", "\\d+\\.\\d+\\.\\d+"', 'Version", "{}"'.format(version)) +def update_cmakelists(path, version): + version_parts = version.split('.') + + replace_in_file(path, 'set\\(LIBLOOT_VERSION "\\d+\\.\\d+\\.\\d+"\\)', 'set(LIBLOOT_VERSION "{}")'.format(version)) + replace_in_file(path, 'TARGET loot PROPERTY SOVERSION \\d+', 'TARGET loot PROPERTY SOVERSION {}'.format(version_parts[0])) + replace_in_file(path, 'INTERFACE_libloot_MAJOR_VERSION \\d+', 'INTERFACE_libloot_MAJOR_VERSION {}'.format(version_parts[0])) + if __name__ == "__main__": parser = argparse.ArgumentParser(description = 'Set the libloot version number') parser.add_argument('version', nargs='+') @@ -44,3 +51,4 @@ def update_resource_file(path, version): update_cpp_file(os.path.join('include', 'loot', 'loot_version.h'), arguments.version[0]) update_resource_file(os.path.join('src', 'api', 'resource.rc'), arguments.version[0]) + update_cmakelists(os.path.join('CMakeLists.txt'), arguments.version[0])