--- a/CMakeLists.txt	2015-12-09 08:12:34.000000000 -0800
+++ b/CMakeLists.txt	2021-04-04 18:06:50.214542500 -0700
@@ -11,8 +11,12 @@
 
 set(LIBWEBM_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 
+if (BUILD_SHARED_LIBS)
+   link_libraries(-static stdc++ -dynamic)
+endif()
+
 # Libwebm section.
-add_library(webm STATIC
+add_library(webm
             "${LIBWEBM_SRC_DIR}/mkvmuxer.cpp"
             "${LIBWEBM_SRC_DIR}/mkvmuxer.hpp"
             "${LIBWEBM_SRC_DIR}/mkvmuxertypes.hpp"
@@ -62,3 +66,21 @@
                "${LIBWEBM_SRC_DIR}/webm2pes.cc"
                "${LIBWEBM_SRC_DIR}/webm2pes.h")
 target_link_libraries(webm2pes LINK_PUBLIC webm)
+
+# This stuff copied directly from the Arch MAKEPKG
+install(
+FILES
+  "mkvmuxer.hpp"
+  "mkvmuxertypes.hpp"
+  "mkvmuxerutil.hpp"
+  "mkvparser.hpp"
+  "mkvreader.hpp"
+  "mkvwriter.hpp"
+  "webmids.hpp"
+DESTINATION
+  "include/webm")
+
+install(TARGETS webm vttdemux webm2pes
+        RUNTIME DESTINATION bin
+        ARCHIVE DESTINATION lib
+        LIBRARY DESTINATION lib)
