1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 SET(project_prefix "capi")
4 SET(libdir ${LIB_INSTALL_DIR})
7 SET(submodule "peripheral-io")
8 SET(fw_name "${project_prefix}-${service}-${submodule}")
12 SET(dependents "dlog glib-2.0 gio-2.0 capi-base-common")
13 SET(pc_dependents "capi-base-common")
15 SET(CMAKE_INSTALL_PREFIX ${prefix})
16 SET(PREFIX $(CMAKE_INSTALL_PREFIX))
17 SET(VERSION ${version})
20 INCLUDE_DIRECTORIES(${INC_DIR})
22 INCLUDE(FindPkgConfig)
23 pkg_check_modules(${fw_name} REQUIRED ${dependents})
24 FOREACH(flag ${${fw_name}_CFLAGS})
25 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
28 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
30 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fPIC")
31 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
32 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
34 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=%{_libdir}")
36 SET(SOURCES src/peripheral_adc.c
44 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
46 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
48 SET_TARGET_PROPERTIES(${fw_name}
55 INSTALL(TARGETS ${fw_name} DESTINATION ${libdir})
57 DIRECTORY ${INC_DIR}/ DESTINATION include
59 PATTERN "${INC_DIR}/*.h"
62 SET(PC_NAME ${fw_name})
63 SET(PC_REQUIRED ${pc_dependents})
64 SET(PC_LDFLAGS -l${fw_name})
71 INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${libdir}/pkgconfig)
73 ADD_SUBDIRECTORY(test)