From: Tomasz Buchert <tomasz@debian.org>
Date: Tue, 25 Aug 2015 09:36:21 +0200
Subject: Patch cmake files

We change three things:

   * we comment out machine-specific compiler flags
   * we disable compilation of "external" libraries; libdivsufsort is
     packaged in Debian now
   * use GNUInstallDirs
---
 CMakeLists.txt              | 21 ++++++++++++---------
 include/sdsl/CMakeLists.txt |  2 +-
 lib/CMakeLists.txt          |  6 +++---
 3 files changed, 16 insertions(+), 13 deletions(-)

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,14 +74,7 @@ if( MODE_TI )
   endif()
 endif()
 
-include(CheckSSE4_2)
-if( BUILTIN_POPCNT )
-    if( CMAKE_COMPILER_IS_GNUCXX )
-        append_cxx_compiler_flags("-msse4.2" "GCC" CMAKE_CXX_OPT_FLAGS)
-    else()
-        append_cxx_compiler_flags("-msse4.2" "CLANG" CMAKE_CXX_OPT_FLAGS)
-    endif()
-endif()
+include(GNUInstallDirs)
 
 # check for demangle support to get pretty C++ class names
 include(FindCxaDemangle)
@@ -106,7 +99,6 @@ else()
     message(WARNING "git not found. Cloning of submodules will not work.")
 endif()
 
-add_subdirectory(external)
 add_subdirectory(include)
 add_subdirectory(lib)
 
--- a/include/sdsl/CMakeLists.txt
+++ b/include/sdsl/CMakeLists.txt
@@ -11,7 +11,7 @@ file(GLOB hppFiles RELATIVE ${CMAKE_CURR
 
 foreach(hppFile ${hppFiles}) # copy each file
 	configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/${hppFile}" "${CMAKE_CURRENT_BINARY_DIR}/${hppFile}" COPYONLY ) 
-	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${hppFile}" DESTINATION include/sdsl)
+	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${hppFile}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sdsl")
 #	MESSAGE(${hppFile})
 endforeach(hppFile)
 
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,6 +1,5 @@
 include_directories(#"${CMAKE_CURRENT_SOURCE_DIR}/../include"
         "${CMAKE_CURRENT_BINARY_DIR}/../include"
-        "${CMAKE_CURRENT_BINARY_DIR}/../external/libdivsufsort/include"
         )
 
 
@@ -11,12 +10,13 @@ endif()
 
 set( sdsl_SRCS ${libFiles} ${headerFiles})
 
-add_library( sdsl ${sdsl_SRCS} )
+add_library( sdsl_static ${sdsl_SRCS} )
+add_library( sdsl SHARED ${sdsl_SRCS} )
 
 install(TARGETS sdsl
         RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib)
+        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+        ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
         
 math(EXPR SOVERSION "${LIBRARY_VERSION_MAJOR}+1")
 
