From d5cc703848b44c1a9c543dc01355b7881f66ea81 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Sun, 12 May 2019 22:16:19 -0400
Subject: [PATCH] Allow mtxclient to be built as a static library

---
 CMakeLists.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f6bfa5b7..033586fc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ option(BUILD_LIB_TESTS "Build tests" ON)
 option(BUILD_LIB_EXAMPLES "Build examples" ON)
 option(COVERAGE "Calculate test coverage" OFF)
 option(IWYU "Check headers with include-what-you-use" OFF)
+option(MTX_STATIC "Specifies whether to build mtxclient as a static lib or not" OFF)
 
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 set(CMAKE_CXX_STANDARD 14)
@@ -107,7 +108,12 @@ set_package_properties(Boost PROPERTIES
     TYPE REQUIRED
 )
 
-add_library(matrix_client SHARED
+set(LINK_TYPE SHARED)
+if(MTX_STATIC)
+    set(LINK_TYPE STATIC)
+endif(MTX_STATIC)
+
+add_library(matrix_client ${LINK_TYPE}
             lib/http/client.cpp
             lib/http/session.cpp
             lib/crypto/client.cpp
-- 
GitLab