diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf513773..348a8742 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,9 +26,9 @@ SET(CMAKE_SCRIPTS "${CMAKE_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
## build settings
-SET(PAHO_VERSION_MAJOR 1)
-SET(PAHO_VERSION_MINOR 3)
-SET(PAHO_VERSION_PATCH 1)
+file(READ version.major PAHO_VERSION_MAJOR)
+file(READ version.minor PAHO_VERSION_MINOR)
+file(READ version.patch PAHO_VERSION_PATCH)
SET(CLIENT_VERSION ${PAHO_VERSION_MAJOR}.${PAHO_VERSION_MINOR}.${PAHO_VERSION_PATCH})
INCLUDE(GNUInstallDirs)
diff --git a/Makefile b/Makefile
index 0cf38fa4..bc54e9f6 100755
--- a/Makefile
+++ b/Makefile
@@ -23,8 +23,12 @@
SHELL = /bin/sh
.PHONY: clean, mkdir, install, uninstall, html
+MAJOR_VERSION := $(shell cat version.major)
+MINOR_VERSION := $(shell cat version.minor)
+PATCH_VERSION := $(shell cat version.patch)
+
ifndef release.version
- release.version = 1.3.1
+ release.version = $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
endif
# determine current platform
@@ -128,8 +132,6 @@ INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
DOXYGEN_COMMAND = doxygen
-MAJOR_VERSION = 1
-MINOR_VERSION = 0
VERSION = ${MAJOR_VERSION}.${MINOR_VERSION}
MQTTLIB_C_NAME = lib${MQTTLIB_C}.so.${VERSION}
diff --git a/build.xml b/build.xml
index 71631e99..e648965e 100644
--- a/build.xml
+++ b/build.xml
@@ -24,7 +24,10 @@
-
+
+
+
+
diff --git a/version.major b/version.major
new file mode 100644
index 00000000..56a6051c
--- /dev/null
+++ b/version.major
@@ -0,0 +1 @@
+1
\ No newline at end of file
diff --git a/version.minor b/version.minor
new file mode 100644
index 00000000..e440e5c8
--- /dev/null
+++ b/version.minor
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git a/version.patch b/version.patch
new file mode 100644
index 00000000..56a6051c
--- /dev/null
+++ b/version.patch
@@ -0,0 +1 @@
+1
\ No newline at end of file