Allow building RE2 as a shared library with CMake.

Fixes #66.

Change-Id: I071bb64b560bf4b299a194607193373c813a53e9
Reviewed-on: https://code-review.googlesource.com/3700
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97b4c90..c6c6060 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@
 cmake_minimum_required(VERSION 2.8.7)
 
 project(RE2 CXX)
+option(BUILD_SHARED_LIBS "build shared libraries" OFF)
 option(USEPCRE "use PCRE in tests and benchmarks" OFF)
 
 set(EXTRA_TARGET_LINK_LIBRARIES)
@@ -54,7 +55,7 @@
     util/valgrind.cc
     )
 
-add_library(re2 STATIC ${RE2_LIBRARY_SOURCES})
+add_library(re2 ${RE2_LIBRARY_SOURCES})
 
 set(TEST_LIBRARY_SOURCES
     re2/testing/backtrack.cc