cmake: add BUILD_SHARED_LIBS option

Linux distributions like Fedora and OpenSUSE build gdb against a static
libipt, which is obtained by patching libipt/CMakeLists.txt:
...
-add_library(libipt SHARED
+add_library(libipt STATIC
...

Add option BUILD_SHARED_LIBS that can be used to build a static instead of a
shared library:
...
$ cmake $src -DBUILD_SHARED_LIBS=OFF
...

Signed-off-by: Tom de Vries <tdevries@suse.de>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4c4c25..4761da3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,6 +78,7 @@
 option(PTUNIT "Enable ptunit, a unit test system and libipt unit tests")
 option(MAN "Enable man pages (requires pandoc)." OFF)
 option(SIDEBAND "Enable libipt-sb, a sideband correlation library")
+option(BUILD_SHARED_LIBS "Build the shared library" ON)
 
 if (SIDEBAND)
   option(PEVENT "Enable perf_event sideband support." OFF)
diff --git a/libipt/CMakeLists.txt b/libipt/CMakeLists.txt
index e6a1956..5e9cf5b 100644
--- a/libipt/CMakeLists.txt
+++ b/libipt/CMakeLists.txt
@@ -85,7 +85,7 @@
 
 set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES})
 
-add_library(libipt SHARED
+add_library(libipt
   ${LIBIPT_FILES}
 )
 
diff --git a/sideband/CMakeLists.txt b/sideband/CMakeLists.txt
index bae20b2..449b4e0 100644
--- a/sideband/CMakeLists.txt
+++ b/sideband/CMakeLists.txt
@@ -43,7 +43,7 @@
   )
 endif (CMAKE_HOST_WIN32)
 
-add_library(libipt-sb SHARED ${LIBSB_FILES})
+add_library(libipt-sb ${LIBSB_FILES})
 
 # put the version into the header
 #