--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,13 +12,7 @@
 cmake_minimum_required(VERSION 2.6)
 PROJECT(apennine)
 set (VERSION 0.1.0)
-
-set(RC_VERSION ${VERSION})
-STRING(REGEX REPLACE "[.]" "," RC_VERSION ${RC_VERSION})
-set(RC_VERSION "${RC_VERSION},0")
-
-set(SOVERSION ${VERSION})
-STRING(REGEX REPLACE "[.].*$" "" SOVERSION ${SOVERSION})
+set (SOVERSION 0)
 
 # when we override default install prefix, assume full path is used...
 
@@ -141,7 +135,7 @@
 
 # Set defaults and pass common options.  Common build options can be passed
 # to cmake using cmake -DWITH_CFLAGS="...", WITH_LIBS, and WITH_INCLUDES
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc ${WITH_INCLUDES})
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/inc ${WITH_INCLUDES})
 add_definitions(${WITH_CFLAGS})
 link_libraries(${WITH_LIBS})
 
@@ -149,7 +143,7 @@
     message(STATUS "  Using local ucommon dependency")
 else()
     find_package(PkgConfig)
-    pkg_check_modules(USES_UCOMMON REQUIRED ucommon>=6.0.0)
+    pkg_check_modules(USES_UCOMMON REQUIRED ucommon>=4.0.1)
 endif()
 
 include_directories(${USES_UCOMMON_INCLUDE_DIRS})
@@ -165,8 +159,11 @@
     set(BUILD_LIBRARY_TYPE SHARED)
 endif()
 
-configure_file(apennine-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/apennine-config.h)
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
+if(NOT BUILD_RUNTIME_TYPE)
+    set(BUILD_RUNTIME_TYPE ${BUILD_LIBRARY_TYPE})
+endif()
+
+configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 
 file(GLOB apennine_inc inc/apennine/*.h)
 file(GLOB common_src common/*.cpp)
@@ -188,23 +185,21 @@
 install(TARGETS apennine DESTINATION ${INSTALL_LIBDIR})
 install(TARGETS apennine-server DESTINATION ${INSTALL_SBINDIR})
 
-if(EXISTS ".svn")
-    if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
-        set(DISTNAME ${PROJECT_NAME})
-        add_custom_target(dist
-            COMMAND rm -f ${DISTNAME}-${VERSION}.zip
-            COMMAND rm -f ${DISTNAME}-${VERSION}.tar.gz
-            COMMAND rm -rf ${DISTNAME}-${VERSION}
-            COMMAND mkdir ${DISTNAME}-${VERSION}
-            COMMAND zip -q  ${DISTNAME}-${VERSION}.zip `svn ls --recursive`
-            COMMAND unzip -q ${DISTNAME}-${VERSION}.zip -d ${DISTNAME}-${VERSION}
-            COMMAND tar -cvzf ${DISTNAME}-${VERSION}.tar.gz ${DISTNAME}-${VERSION}
-            COMMAND rm -rf ${DISTNAME}-${VERSION}
-            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        )
-    endif()
+if(EXISTS ".svn" AND (${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME}))
+    set(DISTNAME ${PROJECT_NAME})
+    add_custom_target(dist
+        COMMAND rm -f ${DISTNAME}-${VERSION}.zip
+        COMMAND rm -f ${DISTNAME}-${VERSION}.tar.gz
+        COMMAND rm -rf ${DISTNAME}-${VERSION}
+        COMMAND mkdir ${DISTNAME}-${VERSION}
+        COMMAND zip -q  ${DISTNAME}-${VERSION}.zip `svn ls --recursive`
+        COMMAND unzip -q ${DISTNAME}-${VERSION}.zip -d ${DISTNAME}-${VERSION}
+        COMMAND tar -cvzf ${DISTNAME}-${VERSION}.tar.gz ${DISTNAME}-${VERSION}
+        COMMAND rm -rf ${DISTNAME}-${VERSION}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    )
 endif()
 
 if (NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
+  set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
 endif ()