uqmi: Added CMake option BUILD_STATIC for a static uqmi build
authorBachtin, Dmitri <dbachtin@init-ka.de>
Wed, 9 Sep 2015 07:35:49 +0000 (09:35 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 11 Sep 2015 16:08:38 +0000 (18:08 +0200)
Signed-off-by: Dmitri Bachtin <dbachtin@init-ka.de>
CMakeLists.txt

index 3f676525473e48fff5bd5e8fe8cf365b3899c680..4a115449ea4df8e6e8d569d81973e64a6828eb9a 100644 (file)
@@ -1,14 +1,26 @@
 cmake_minimum_required(VERSION 2.6)
 
 PROJECT(uqmi C)
+
+OPTION(BUILD_STATIC OFF)
+
 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-enum-conversion)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 
 SET(SOURCES main.c dev.c commands.c qmi-message.c)
 
-FIND_LIBRARY(json json-c json)
-SET(LIBS ubox blobmsg_json ${json})
+IF(BUILD_STATIC)
+  FIND_LIBRARY(json NAMES libjson.a libjson-c.a)
+  FIND_LIBRARY(blobmsg_json NAMES libblobmsg_json.a)
+  FIND_LIBRARY(ubox NAMES libubox.a)
+ELSE(BUILD_STATIC)
+  FIND_LIBRARY(json NAMES json-c json)
+  FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+  FIND_LIBRARY(ubox NAMES ubox)
+ENDIF(BUILD_STATIC)
+
+SET(LIBS ${ubox} ${blobmsg_json} ${json})
 
 IF(DEBUG_PACKET)
   ADD_DEFINITIONS(-DDEBUG_PACKET)