1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
4 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
5 SET(EXEC_PREFIX "\${prefix}")
6 SET(LIBDIR "\${prefix}/lib")
7 SET(INCLUDEDIR "\${prefix}/include")
10 INCLUDE(FindPkgConfig)
11 pkg_check_modules(pkgs REQUIRED glib-2.0 dlog)
13 add_definitions(${rpkgs_CFLAGS})
14 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
16 configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
18 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
19 include_directories(${CMAKE_SOURCE_DIR}/src/libsensord)
20 include_directories(${CMAKE_SOURCE_DIR}/src/shared)
22 FOREACH(flag ${pkgs_CFLAGS})
23 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
26 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
28 link_directories(../src/libsensord/)
30 add_executable(accelerometer src/accelerometer.c)
31 add_executable(geomagnetic src/geomagnetic.c)
32 add_executable(orientation src/orientation.c)
33 add_executable(gravity src/gravity.c)
34 add_executable(linear_acceleration src/linear_acceleration.c)
35 add_executable(gyro src/gyro.c)
36 add_executable(proxi src/proxi.c)
37 add_executable(pressure src/pressure.c)
39 SET_TARGET_PROPERTIES(accelerometer PROPERTIES LINKER_LANGUAGE C)
40 SET_TARGET_PROPERTIES(geomagnetic PROPERTIES LINKER_LANGUAGE C)
41 SET_TARGET_PROPERTIES(orientation PROPERTIES LINKER_LANGUAGE C)
42 SET_TARGET_PROPERTIES(gravity PROPERTIES LINKER_LANGUAGE C)
43 SET_TARGET_PROPERTIES(linear_acceleration PROPERTIES LINKER_LANGUAGE C)
44 SET_TARGET_PROPERTIES(gyro PROPERTIES LINKER_LANGUAGE C)
45 SET_TARGET_PROPERTIES(proxi PROPERTIES LINKER_LANGUAGE C)
46 SET_TARGET_PROPERTIES(pressure PROPERTIES LINKER_LANGUAGE C)
48 target_link_libraries(accelerometer glib-2.0 dlog sensor)
49 target_link_libraries(geomagnetic glib-2.0 dlog sensor)
50 target_link_libraries(orientation glib-2.0 dlog sensor)
51 target_link_libraries(gravity glib-2.0 dlog sensor)
52 target_link_libraries(linear_acceleration glib-2.0 dlog sensor)
53 target_link_libraries(gyro glib-2.0 dlog sensor)
54 target_link_libraries(proxi glib-2.0 dlog sensor)
55 target_link_libraries(pressure glib-2.0 dlog sensor)
57 INSTALL(TARGETS accelerometer DESTINATION /usr/bin/)
58 INSTALL(TARGETS geomagnetic DESTINATION /usr/bin/)
59 INSTALL(TARGETS orientation DESTINATION /usr/bin/)
60 INSTALL(TARGETS gravity DESTINATION /usr/bin/)
61 INSTALL(TARGETS linear_acceleration DESTINATION /usr/bin/)
62 INSTALL(TARGETS gyro DESTINATION /usr/bin/)
63 INSTALL(TARGETS proxi DESTINATION /usr/bin/)
64 INSTALL(TARGETS pressure DESTINATION /usr/bin/)