From 7d0879abdca1bf85435b82dcde44907995b1ab44 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 24 Jan 2019 01:31:02 -0800 Subject: [PATCH] cmake: Add ENABLE_SHARED option, default ON Add an ENABLE_SHARED option, defaults to ON, when set to OFF quassel_add_module() will build modules as static (does not affect platforms where modules would be built as static anyway.) The option name ENABLE_SHARED is frequently used for this purpose in cmake. Signed-off-by: Rafael Kitover --- CMakeLists.txt | 6 ++++++ cmake/QuasselMacros.cmake | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9037c89b..f8e97a7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,6 +360,12 @@ if (NOT WIN32) ) endif() +# Shared library support +##################################################################### + +option(ENABLE_SHARED "Build modules as shared libraries" ON) +add_feature_info(ENABLE_SHARED ENABLE_SHARED "Build modules as shared libraries") + # Setup unit testing ##################################################################### diff --git a/cmake/QuasselMacros.cmake b/cmake/QuasselMacros.cmake index 247b6207..6182f704 100644 --- a/cmake/QuasselMacros.cmake +++ b/cmake/QuasselMacros.cmake @@ -45,7 +45,7 @@ function(quassel_add_module _module) string(REPLACE "::" "_" target ${target}) string(REPLACE "_" "-" output_name ${target}) - if (ARG_STATIC) + if (ARG_STATIC OR NOT ENABLE_SHARED) set(buildmode STATIC) else() set(buildmode SHARED) -- 2.20.1