  
  # Installations
  # Note the trailing slash in the argument to the `DIRECTORY' directive
-@@ -138,6 +200,11 @@ install(TARGETS freetype
+@@ -138,6 +208,11 @@ install(TARGETS freetype
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
  )

+)
+string(REPLACE "FT_CONFIG_STANDARD_LIBRARY_H" "<ftstdlib.h>"
+  ftconfig "${ftconfig}"
 )
+string(REPLACE "/undef " "#undef "
+  ftconfig "${ftconfig}"
+)
+file(WRITE ${PROJECT_BINARY_DIR}/include/ftconfig.h "${ftconfig}")
 
 set(BASE_SRCS
   src/autofit/autofit.c
@@ -126,6 +157,37 @@ include_directories("src/psaux")
 include_directories("src/psnames")
 
 add_library(freetype ${BASE_SRCS})
+if (BUILD_SHARED_LIBS)
+  set_target_properties(freetype PROPERTIES
+    SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c782fb7..849b38a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,10 +39,35 @@ cmake_minimum_required(VERSION 2.6)
