From 5bd18b68658c2ba66e358341c159b17d9ba18791 Mon Sep 17 00:00:00 2001
From: Mikhail Paulyshka <me@mixaill.tk>
Date: Wed, 15 Mar 2017 00:01:24 +0300
Subject: [PATCH] fix cmake

- enable shared lib
- add install target
- set _CRT_SECURE_NO_WARNINGS
---
 CMakeLists.txt | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf99829..a7bf021 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,14 +5,21 @@
 ##  tree. An additional intellectual property rights grant can be found
 ##  in the file PATENTS.  All contributing project authors may
 ##  be found in the AUTHORS file in the root of the source tree.
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4)
 project(LIBWEBM)
+
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
 include("${CMAKE_CURRENT_SOURCE_DIR}/build/msvc_runtime.cmake")
 
 set(LIBWEBM_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 
+if(MSVC)
+  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+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 +69,21 @@ add_executable(webm2pes
                "${LIBWEBM_SRC_DIR}/webm2pes.cc"
                "${LIBWEBM_SRC_DIR}/webm2pes.h")
 target_link_libraries(webm2pes LINK_PUBLIC webm)
+
+install(
+  TARGETS webm 
+  RUNTIME DESTINATION bin
+  ARCHIVE DESTINATION lib 
+  LIBRARY DESTINATION lib)
+
+install(
+  FILES 
+    "mkvmuxer.hpp"
+    "mkvmuxertypes.hpp"
+    "mkvmuxerutil.hpp"
+    "mkvparser.hpp"
+    "mkvreader.hpp"
+    "mkvwriter.hpp"
+    "webmids.hpp"
+  DESTINATION 
+    "include/libwebm")
-- 
2.11.0.windows.1

