diff --git a/.gitignore b/.gitignore
index d4db7d27..d85b3eb6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
 *.a
+*.so
+*.so.?*
+*.dylib
 *.cmake
 *~
 /test/benchmark_test
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53731c1d..b557df1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,10 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86")
 	add_definitions(-DARCH_X86)
 endif()
 
+# The version of the libraries
+set(GENERIC_LIB_VERSION "0.0.0")
+set(GENERIC_LIB_SOVERSION "0")
+
 # Set up directories
 include_directories(${PROJECT_SOURCE_DIR}/include)
 include_directories(${PROJECT_SOURCE_DIR}/src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5c6a3908..a2afb0cb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,8 +1,17 @@
 set(SOURCE_FILES "benchmark.cc" "colorprint.cc" "commandlineflags.cc" "sleep.cc" "sysinfo.cc" "walltime.cc")
 set(RE_FILES "re.cc")
 
-add_library(benchmark_re STATIC ${RE_FILES})
-add_library(benchmark STATIC ${SOURCE_FILES} ${RE_FILES})
+add_library(benchmark_re ${RE_FILES})
+set_target_properties(benchmark_re PROPERTIES
+  VERSION ${GENERIC_LIB_VERSION}
+  SOVERSION ${GENERIC_LIB_SOVERSION}
+)
+
+add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
+set_target_properties(benchmark PROPERTIES
+  VERSION ${GENERIC_LIB_VERSION}
+  SOVERSION ${GENERIC_LIB_SOVERSION}
+)
 
 # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
 install(