1 cmake_minimum_required(VERSION 2.6)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-enum-conversion)
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
8 SET(SOURCES main.c dev.c commands.c qmi-message.c)
10 FIND_LIBRARY(json json-c json)
11 SET(LIBS ubox blobmsg_json ${json})
14 ADD_DEFINITIONS(-DDEBUG_PACKET)
18 ADD_DEFINITIONS(-DDEBUG -g3)
23 FOREACH(service ctl dms nas pds wds wms wda)
25 OUTPUT qmi-message-${service}.h
26 COMMAND ./data/gen-header.pl ${service}_ ./data/qmi-service-${service}.json > qmi-message-${service}.h
27 DEPENDS ./data/gen-header.pl ./data/qmi-service-${service}.json ./data/gen-common.pm
29 SET(service_headers ${service_headers} qmi-message-${service}.h)
31 OUTPUT qmi-message-${service}.c
32 COMMAND ./data/gen-code.pl ${service}_ ./data/qmi-service-${service}.json > qmi-message-${service}.c
33 DEPENDS ./data/gen-code.pl ./data/qmi-service-${service}.json ./data/gen-common.pm
35 SET(service_sources ${service_sources} qmi-message-${service}.c)
36 set_property(SOURCE qmi-message-${service}.c PROPERTY COMPILE_FLAGS "-Wno-unused")
41 COMMAND ./data/gen-error-list.pl ./qmi-errors.h > qmi-errors.c
42 DEPENDS ./data/gen-error-list.pl ./qmi-errors.h
44 ADD_CUSTOM_TARGET(gen-errors DEPENDS qmi-errors.c)
45 ADD_CUSTOM_TARGET(gen-headers DEPENDS ${service_headers})
47 ADD_EXECUTABLE(uqmi ${SOURCES} ${service_sources})
48 ADD_DEPENDENCIES(uqmi gen-headers gen-errors)
50 TARGET_LINK_LIBRARIES(uqmi ${LIBS})
53 RUNTIME DESTINATION sbin