3 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
4 SET(CMAKE_BUILD_TYPE, Debug)
5 SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
7 SET(PROJECT_NAME "AFB Daemon")
8 SET(PROJECT_PRETTY_NAME "Application Framework Binder Daemon")
9 SET(PROJECT_DESCRIPTION "Secured binder of API for clients of the Application framework")
10 SET(PROJECT_VERSION "0.5")
11 SET(PROJECT_URL "https://github.com/iotbzh/afb-daemon")
13 INCLUDE(FindPkgConfig)
14 INCLUDE(CheckIncludeFiles)
15 INCLUDE(CheckLibraryExists)
16 INCLUDE(GNUInstallDirs)
18 ###########################################################################
20 link_libraries(-Wl,--as-needed -Wl,--gc-sections)
22 add_compile_options(-Wall -Wextra -Wconversion)
23 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
24 add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
25 add_compile_options(-Werror=maybe-uninitialized)
26 add_compile_options(-Werror=implicit-function-declaration)
27 add_compile_options(-ffunction-sections -fdata-sections)
28 add_compile_options(-Wl,--as-needed -Wl,--gc-sections)
29 add_compile_options(-fPIC)
30 add_compile_options(-g)
32 set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
33 set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
34 set(CMAKE_C_FLAGS_RELEASE "-g -O2")
35 set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
37 ###########################################################################
39 IF(CMAKE_BUILD_TYPE MATCHES Debug)
40 CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
42 MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
43 SET(libefence_LIBRARIES "-lefence")
45 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
47 PKG_CHECK_MODULES(json-c REQUIRED json-c)
54 ${CMAKE_SOURCE_DIR}/include
55 ${json-c_INCLUDE_DIRS}
59 ${libefence_LIBRARIES}
60 ${CMAKE_THREAD_LIBS_INIT}
64 SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
67 ADD_SUBDIRECTORY(include)
68 ADD_SUBDIRECTORY(plugins)
70 ############################################################
71 # installs the pkgconfig file
72 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
75 ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
77 ${CMAKE_INSTALL_LIBDIR}/pkgconfig