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.4")
11 SET(PROJECT_URL "https://github.com/iotbzh/afb-daemon")
13 INCLUDE(FindPkgConfig)
14 INCLUDE(CheckIncludeFiles)
15 INCLUDE(CheckLibraryExists)
16 INCLUDE(GNUInstallDirs)
18 ###########################################################################
20 add_compile_options(-Wall -Wextra -Wconversion)
21 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
22 add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
23 add_compile_options(-Werror=maybe-uninitialized)
24 add_compile_options(-Werror=implicit-function-declaration)
25 add_compile_options(-ffunction-sections -fdata-sections)
26 add_compile_options(-Wl,--gc-sections)
27 add_compile_options(-fPIC)
28 add_compile_options(-g)
30 set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
31 set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
32 set(CMAKE_C_FLAGS_RELEASE "-g -O2")
33 set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
35 ###########################################################################
37 IF(CMAKE_BUILD_TYPE MATCHES Debug)
38 CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
40 MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
41 SET(libefence_LIBRARIES "-lefence")
43 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
45 PKG_CHECK_MODULES(json-c REQUIRED json-c)
52 ${CMAKE_SOURCE_DIR}/include
53 ${json-c_INCLUDE_DIRS}
57 ${libefence_LIBRARIES}
58 ${CMAKE_THREAD_LIBS_INIT}
62 SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
64 ADD_DEFINITIONS(-DPLUGIN_INSTALL_DIR="${plugin_install_dir}")
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_FULL_LIBDIR}/pkgconfig