remove unuseful flags
[src/app-framework-binder.git] / CMakeLists.txt
1 PROJECT(afb-daemon C)
2
3 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
4 SET(CMAKE_BUILD_TYPE, Debug)
5 SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
6
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")
12
13 INCLUDE(FindPkgConfig)
14 INCLUDE(CheckIncludeFiles)
15 INCLUDE(CheckLibraryExists)
16 INCLUDE(GNUInstallDirs)
17
18 ###########################################################################
19
20 link_libraries(-Wl,--as-needed -Wl,--gc-sections)
21
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(-fPIC)
29 add_compile_options(-g)
30
31 set(CMAKE_C_FLAGS_PROFILING    "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
32 set(CMAKE_C_FLAGS_DEBUG        "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
33 set(CMAKE_C_FLAGS_RELEASE      "-g -O2")
34 set(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
35
36 ###########################################################################
37
38 IF(CMAKE_BUILD_TYPE MATCHES Debug)
39   CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
40   IF(HAVE_LIBEFENCE)
41     MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
42     SET(libefence_LIBRARIES "-lefence")
43   ENDIF(HAVE_LIBEFENCE)
44 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
45
46 PKG_CHECK_MODULES(json-c REQUIRED json-c)
47
48 INCLUDE(FindThreads)
49 FIND_PACKAGE(Threads)
50
51 SET(include_dirs
52         ${INCLUDE_DIRS}
53         ${CMAKE_SOURCE_DIR}/include
54         ${json-c_INCLUDE_DIRS}
55         )
56
57 SET(link_libraries
58         ${libefence_LIBRARIES}
59         ${CMAKE_THREAD_LIBS_INIT}
60         ${json-c_LIBRARIES}
61         )
62
63 SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
64
65 ADD_SUBDIRECTORY(src)
66 ADD_SUBDIRECTORY(include)
67 ADD_SUBDIRECTORY(plugins)
68
69 ############################################################
70 # installs the pkgconfig file
71 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
72
73 INSTALL(FILES
74     ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
75     DESTINATION
76     ${CMAKE_INSTALL_LIBDIR}/pkgconfig
77     )
78