1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(PACKAGE ${PROJECT_NAME})
4 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
5 SET(BINDIR "${PREFIX}/sbin")
6 SET(DATADIR "${PREFIX}/share")
7 SET(LIBDIR "${PREFIX}/lib")
19 src/network-statistics.c
23 src/wifi-background-scan.c
27 src/dbus/netsupplicant.c
30 src/utils/mdm-private.c
33 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
34 SET(CMAKE_BUILD_TYPE "Release")
35 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
36 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
38 INCLUDE(FindPkgConfig)
39 PKG_CHECK_MODULES(pkgs REQUIRED
48 FOREACH(flag ${pkgs_CFLAGS})
49 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
52 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
53 SET(CMAKE_C_FLAGS "-I${CMAKE_SOURCE_DIR}/include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
54 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
55 SET(CMAKE_C_FLAGS_RELEASE "-O2")
57 FIND_PROGRAM(UNAME NAMES uname)
58 EXEC_PROGRAM("${UNAME}" ARGS "-m"
59 OUTPUT_VARIABLE "ARCH")
60 IF("${ARCH}" STREQUAL "arm")
61 ADD_DEFINITIONS("-DEMBEDDED_TARGET")
62 MESSAGE("add -DEMBEDDED_TARGET")
63 ENDIF("${ARCH}" STREQUAL "arm")
65 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
66 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
68 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
70 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
71 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
73 ADD_CUSTOM_TARGET(netconfig-iface-network-state-glue.h
74 COMMAND dbus-binding-tool --mode=glib-server --prefix=netconfig_iface_network_state
75 --output=${CMAKE_SOURCE_DIR}/include/netconfig-iface-network-state-glue.h
76 ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-network-state.xml
77 DEPENDS ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-network-state.xml
79 ADD_CUSTOM_TARGET(netconfig-iface-network-statistics-glue.h
80 COMMAND dbus-binding-tool --mode=glib-server --prefix=netconfig_iface_network_statistics
81 --output=${CMAKE_SOURCE_DIR}/include/netconfig-iface-network-statistics-glue.h
82 ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-network-statistics.xml
83 DEPENDS ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-network-statistics.xml
85 ADD_CUSTOM_TARGET(netconfig-iface-wifi-glue.h
86 COMMAND dbus-binding-tool --mode=glib-server --prefix=netconfig_iface_wifi
87 --output=${CMAKE_SOURCE_DIR}/include/netconfig-iface-wifi-glue.h
88 ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-wifi.xml
89 DEPENDS ${CMAKE_SOURCE_DIR}/interfaces/netconfig-iface-wifi.xml
92 ADD_DEPENDENCIES(${PROJECT_NAME} netconfig-iface-network-state-glue.h)
93 ADD_DEPENDENCIES(${PROJECT_NAME} netconfig-iface-network-statistics-glue.h)
94 ADD_DEPENDENCIES(${PROJECT_NAME} netconfig-iface-wifi-glue.h)
96 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})