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_VERSION "0.4")
11 INCLUDE(FindPkgConfig)
12 INCLUDE(CheckIncludeFiles)
13 INCLUDE(CheckLibraryExists)
14 INCLUDE(GNUInstallDirs)
16 ###########################################################################
18 add_compile_options(-Wall -Wextra -Wconversion)
19 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
20 add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
21 add_compile_options(-Werror=maybe-uninitialized)
22 add_compile_options(-Werror=implicit-function-declaration)
23 add_compile_options(-ffunction-sections -fdata-sections)
24 add_compile_options(-Wl,--gc-sections)
25 add_compile_options(-fPIC)
26 add_compile_options(-g)
28 set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
29 set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
30 set(CMAKE_C_FLAGS_RELEASE "-g -O2")
31 set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
33 ###########################################################################
35 IF(CMAKE_BUILD_TYPE MATCHES Debug)
36 CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
38 MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
39 SET(libefence_LIBRARIES "-lefence")
41 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
43 PKG_CHECK_MODULES(json-c REQUIRED json-c)
50 ${CMAKE_SOURCE_DIR}/include
51 ${json-c_INCLUDE_DIRS}
55 ${libefence_LIBRARIES}
56 ${CMAKE_THREAD_LIBS_INIT}
60 SET(plugin_install_dir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/afb)
62 ADD_DEFINITIONS(-DPLUGIN_INSTALL_DIR="${plugin_install_dir}")
65 ADD_SUBDIRECTORY(include)
66 ADD_SUBDIRECTORY(plugins)