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 "1.0")
11 SET(PROJECT_URL "https://github.com/iotbzh/afb-daemon")
13 SET(LIBAFBWSC_VERSION "1.0")
14 SET(LIBAFBWSC_SOVERSION "1")
16 INCLUDE(FindPkgConfig)
17 INCLUDE(CheckIncludeFiles)
18 INCLUDE(CheckLibraryExists)
19 INCLUDE(GNUInstallDirs)
21 ###########################################################################
23 link_libraries(-Wl,--as-needed -Wl,--gc-sections)
25 add_compile_options(-Wall -Wextra -Wconversion)
26 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
27 add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
28 add_compile_options(-Werror=maybe-uninitialized)
29 add_compile_options(-Werror=implicit-function-declaration)
30 add_compile_options(-ffunction-sections -fdata-sections)
31 add_compile_options(-fPIC)
32 add_compile_options(-g)
34 set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
35 set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
36 set(CMAKE_C_FLAGS_RELEASE "-g -O2")
37 set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
39 ###########################################################################
41 IF(CMAKE_BUILD_TYPE MATCHES Debug)
42 CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
44 MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
45 SET(libefence_LIBRARIES "-lefence")
47 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
49 PKG_CHECK_MODULES(json-c REQUIRED json-c)
56 ${CMAKE_SOURCE_DIR}/include
57 ${json-c_INCLUDE_DIRS}
61 ${libefence_LIBRARIES}
62 ${CMAKE_THREAD_LIBS_INIT}
66 SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
69 ADD_SUBDIRECTORY(include)
70 ADD_SUBDIRECTORY(plugins)
72 ############################################################
73 # installs the pkgconfig files
74 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
75 CONFIGURE_FILE(libafbwsc.pc.in libafbwsc.pc @ONLY)
78 ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
79 ${CMAKE_CURRENT_BINARY_DIR}/libafbwsc.pc
81 ${CMAKE_INSTALL_LIBDIR}/pkgconfig