cmake: Add ENABLE_SHARED option, default ON
authorRafael Kitover <rkitover@gmail.com>
Thu, 24 Jan 2019 09:31:02 +0000 (01:31 -0800)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 31 May 2019 17:32:40 +0000 (19:32 +0200)
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 <rkitover@gmail.com>
CMakeLists.txt
cmake/QuasselMacros.cmake

index 9037c89..f8e97a7 100644 (file)
@@ -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
 #####################################################################
 
index 247b620..6182f70 100644 (file)
@@ -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)