CMake: Added option whether to build static or shared library
authorMax <max.maisel@posteo.de>
Thu, 1 Mar 2018 16:20:35 +0000 (17:20 +0100)
committerMax Maisel <max.maisel@posteo.de>
Thu, 1 Mar 2018 17:13:11 +0000 (18:13 +0100)
src/CMakeLists.txt

index 82d6a6b08c642d02468b2c8fc904c331aa9d34c9..3b82fcf6a7d646ab53de28cb7485dc228ad3dae9 100644 (file)
@@ -1,8 +1,14 @@
 
+option(LWEXT4_BUILD_SHARED_LIB "Build shared library" OFF)
+
 #LIBRARY
 include_directories(.)
 aux_source_directory(. LWEXT4_SRC)
-add_library(lwext4 STATIC ${LWEXT4_SRC})
+if(LWEXT4_BUILD_SHARED_LIB)
+  add_library(lwext4 SHARED ${LWEXT4_SRC})
+else()
+  add_library(lwext4 STATIC ${LWEXT4_SRC})
+endif()
 
 if  (DEFINED SIZE)
     add_custom_target(lib_size ALL DEPENDS lwext4 COMMAND ${SIZE} liblwext4.a)