Install headers, libraries and pdf

Headers are installed in ${CMAKE_INSTALL_PREFIX}/include/ceres
Libraries are installed in ${CMAKE_INSTALL_PREFIX}/lib
pdf is installed in ${CMAKE_INSTALL_PREFIX}/share/ceres/docs

Change-Id: Ic175f2c2f5fa86820a1e8c64c2ed171f4a302a68
diff --git a/CMakeLists.txt b/CMakeLists.txt
index afc8fe5..fbdbc86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -514,6 +514,12 @@
   ${EIGEN_INCLUDE}
   )
 
+FILE(GLOB CERES_HDRS ${CMAKE_SOURCE_DIR}/include/ceres/*.h)
+INSTALL(FILES ${CERES_HDRS} DESTINATION include/ceres)
+
+FILE(GLOB CERES_PUBLIC_INTERNAL_HDRS ${CMAKE_SOURCE_DIR}/include/ceres/internal/*.h)
+INSTALL(FILES ${CERES_PUBLIC_INTERNAL_HDRS} DESTINATION include/ceres/internal)
+
 IF (${SUITESPARSE})
   INCLUDE_DIRECTORIES(${AMD_INCLUDE})
   INCLUDE_DIRECTORIES(${CAMD_INCLUDE})
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index cd98662..50de45d 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -61,3 +61,6 @@
         -shell-escape ${CMAKE_BINARY_DIR}/docs/ceres-solver.tex
         -output-directory ${CMAKE_BINARY_DIR}/docs
         WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/docs)
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/docs/ceres-solver.pdf
+        DESTINATION share/ceres/docs)
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
index a914005..c388316 100644
--- a/internal/ceres/CMakeLists.txt
+++ b/internal/ceres/CMakeLists.txt
@@ -112,6 +112,11 @@
   # The Android logging library that defines e.g. __android_log_print is
   # creatively named "log".
   TARGET_LINK_LIBRARIES(miniglog log)
+
+  INSTALL(TARGETS miniglog
+          RUNTIME DESTINATION bin
+          LIBRARY DESTINATION lib
+          ARCHIVE DESTINATION lib)
 ENDIF (${BUILD_ANDROID})
 
 SET(CERES_LIBRARY_DEPENDENCIES ${GLOG_LIB})
@@ -163,14 +168,25 @@
 ADD_LIBRARY(ceres STATIC ${CERES_LIBRARY_SOURCE})
 TARGET_LINK_LIBRARIES(ceres ${CERES_LIBRARY_DEPENDENCIES})
 
+INSTALL(TARGETS ceres
+        RUNTIME DESTINATION bin
+        LIBRARY DESTINATION lib
+        ARCHIVE DESTINATION lib)
+
 # Don't build a DLL on MSVC. Supporting Ceres as a DLL on Windows involves
 # nontrivial changes that we haven't made yet.
 IF (NOT MSVC AND NOT ${BUILD_ANDROID})
   ADD_LIBRARY(ceres_shared SHARED ${CERES_LIBRARY_SOURCE})
   TARGET_LINK_LIBRARIES(ceres_shared ${CERES_LIBRARY_DEPENDENCIES})
   SET_TARGET_PROPERTIES(ceres_shared PROPERTIES
-      VERSION ${CERES_VERSION}
-      SOVERSION ${CERES_ABI_VERSION})
+                        VERSION ${CERES_VERSION}
+                        SOVERSION ${CERES_ABI_VERSION})
+
+  INSTALL(TARGETS ceres_shared
+          RUNTIME DESTINATION bin
+          LIBRARY DESTINATION lib
+          ARCHIVE DESTINATION lib)
+
 ENDIF (NOT MSVC AND NOT ${BUILD_ANDROID})
 
 IF (${BUILD_TESTING} AND ${GFLAGS})