PROJECT(bpdyndnsd)
 
+set(MAJOR_VERSION 1)
+set(MINOR_VERSION 0)
+set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
+
 # if you don't want the full compiler output, remove the following line
 SET(CMAKE_VERBOSE_MAKEFILE ON)
 
 
 find_package(OpenSSL)
 
 # Includes
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
+include_directories(    ${CMAKE_CURRENT_BINARY_DIR}
+                        ${CMAKE_CURRENT_SOURCE_DIR}
                                    ${CURL_INCLUDES}
                                    ${OPENSSL_INCLUDES}
                                 )
 
+configure_file ("${PROJECT_SOURCE_DIR}/src/version_info.h.in" "${PROJECT_BINARY_DIR}/src/version_info.h")
+
 # C++ sources
 set(cpp_sources
         config.cpp
         tcp_service.hpp
         updater.hpp
         util.hpp
+        version_info.h
     )
 
 add_executable(bpdyndnsd ${cpp_sources} ${cpp_headers})
 
 
 
 #include "logger.hpp"
+#include "version_info.h"
 
 #include <iostream>
 #include <syslog.h>
 
 #include <boost/foreach.hpp>
 
-#define VERSION     0
-#define REVISION    1
-#define RELEASE     0
-
 namespace po = boost::program_options;
 
 typedef boost::shared_ptr<boost::program_options::options_description> Options_descriptionPtr;
     if ( level <= Loglevel )
     {
         ostringstream msg;
-        msg << "Bullet proof dynamic dns daemon.\nbpdyndnsd " << VERSION << "." << REVISION << "." << RELEASE << endl;
+        msg << "Bullet proof dynamic dns daemon.\nbpdyndnsd " << MAJOR_VERSION << "." << MINOR_VERSION << endl;
         log_notice(msg.str());
     }
 }
 
--- /dev/null
+#ifndef _VERSION_INFO_H_
+#define _VERSION_INFO_H_
+
+#define MAJOR_VERSION @MAJOR_VERSION@
+#define MINOR_VERSION @MINOR_VERSION@
+
+#endif