Merge "Add a CMake install step for webm_parser."
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dc3efe..9fa5a53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,7 @@
 cmake_minimum_required(VERSION 3.2)
 project(LIBWEBM CXX)
 
+include(GNUInstallDirs)
 include("${CMAKE_CURRENT_SOURCE_DIR}/build/cxx_flags.cmake")
 
 if (NOT BUILD_SHARED_LIBS)
@@ -119,7 +120,7 @@
     "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc"
     "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h")
 
-set(webm_parser_sources
+set(webm_parser_public_headers
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/buffer_reader.h"
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/callback.h"
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/dom_types.h"
@@ -129,7 +130,10 @@
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/istream_reader.h"
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/reader.h"
     "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/status.h"
-    "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/webm_parser.h"
+    "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/webm_parser.h")
+
+set(webm_parser_sources
+    ${webm_parser_public_headers}
     "${LIBWEBM_SRC_DIR}/webm_parser/src/ancestory.cc"
     "${LIBWEBM_SRC_DIR}/webm_parser/src/ancestory.h"
     "${LIBWEBM_SRC_DIR}/webm_parser/src/audio_parser.h"
@@ -354,9 +358,17 @@
   include_directories(webm_parser webm_parser/include)
   add_library(webm_parser OBJECT ${webm_parser_sources})
   target_sources(webm PUBLIC $<TARGET_OBJECTS:webm_parser>)
+  set_target_properties(webm PROPERTIES PUBLIC_HEADER
+                        "${webm_parser_public_headers}")
 
   add_executable(webm_parser_demo ${webm_parser_demo_sources})
   target_link_libraries(webm_parser_demo LINK_PUBLIC webm)
+
+  install(TARGETS webm
+          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+          PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webm)
 endif ()
 
 if (ENABLE_WEBMTS)