Add command to specify preferred PLMN
[project/uqmi.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(uqmi C)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-enum-conversion)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 SET(SOURCES main.c dev.c commands.c qmi-message.c)
9
10 FIND_LIBRARY(json json-c json)
11 SET(LIBS ubox blobmsg_json ${json})
12
13 IF(DEBUG_PACKET)
14   ADD_DEFINITIONS(-DDEBUG_PACKET)
15 ENDIF()
16
17 IF(DEBUG)
18   ADD_DEFINITIONS(-DDEBUG -g3)
19 ENDIF()
20
21 SET(service_headers)
22 SET(service_sources)
23 FOREACH(service ctl dms nas pds wds wms wda)
24         ADD_CUSTOM_COMMAND(
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
28         )
29         SET(service_headers ${service_headers} qmi-message-${service}.h)
30         ADD_CUSTOM_COMMAND(
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
34         )
35         SET(service_sources ${service_sources} qmi-message-${service}.c)
36         set_property(SOURCE qmi-message-${service}.c PROPERTY COMPILE_FLAGS "-Wno-unused")
37 ENDFOREACH()
38
39 ADD_CUSTOM_COMMAND(
40         OUTPUT qmi-errors.c
41         COMMAND ./data/gen-error-list.pl ./qmi-errors.h > qmi-errors.c
42         DEPENDS ./data/gen-error-list.pl ./qmi-errors.h
43 )
44 ADD_CUSTOM_TARGET(gen-errors DEPENDS qmi-errors.c)
45 ADD_CUSTOM_TARGET(gen-headers DEPENDS ${service_headers})
46
47 ADD_EXECUTABLE(uqmi ${SOURCES} ${service_sources})
48 ADD_DEPENDENCIES(uqmi gen-headers gen-errors)
49
50 TARGET_LINK_LIBRARIES(uqmi ${LIBS})
51
52 INSTALL(TARGETS uqmi
53         RUNTIME DESTINATION sbin
54 )