fix support for Option modems
[project/usbmode.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(usbmode C)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
5
6 FIND_PATH(ubox_include_dir libubox/blobmsg_json.h)
7 INCLUDE_DIRECTORIES(${ubox_include_dir})
8
9 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
10
11 SET(SOURCES main.c switch.c)
12
13 find_package(PkgConfig)
14 pkg_check_modules(LIBUSB1 REQUIRED libusb-1.0)
15 ADD_DEFINITIONS(${LIBUSB1_CFLAGS})
16 FIND_LIBRARY(libusb NAMES usb-1.0 HINTS ${LIBUSB1_LIBDIR})
17 FIND_LIBRARY(json NAMES json-c json)
18
19 SET(LIBS ubox blobmsg_json ${libusb} ${json})
20
21 IF(DEBUG)
22   ADD_DEFINITIONS(-DDEBUG -g3)
23 ENDIF()
24
25 ADD_EXECUTABLE(usbmode ${SOURCES})
26 TARGET_LINK_LIBRARIES(usbmode ${LIBS})
27
28 INSTALL(TARGETS usbmode
29         RUNTIME DESTINATION sbin
30 )