adds a pkgconfig file
[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.4")
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 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)
29
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")
34
35 ###########################################################################
36
37 IF(CMAKE_BUILD_TYPE MATCHES Debug)
38   CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
39   IF(HAVE_LIBEFENCE)
40     MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
41     SET(libefence_LIBRARIES "-lefence")
42   ENDIF(HAVE_LIBEFENCE)
43 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
44
45 PKG_CHECK_MODULES(json-c REQUIRED json-c)
46
47 INCLUDE(FindThreads)
48 FIND_PACKAGE(Threads)
49
50 SET(include_dirs
51         ${INCLUDE_DIRS}
52         ${CMAKE_SOURCE_DIR}/include
53         ${json-c_INCLUDE_DIRS}
54 )
55
56 SET(link_libraries
57         ${libefence_LIBRARIES}
58         ${CMAKE_THREAD_LIBS_INIT}
59         ${json-c_LIBRARIES}
60 )
61
62 SET(plugin_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
63
64 ADD_DEFINITIONS(-DPLUGIN_INSTALL_DIR="${plugin_install_dir}")
65
66 ADD_SUBDIRECTORY(src)
67 ADD_SUBDIRECTORY(include)
68 ADD_SUBDIRECTORY(plugins)
69
70 ############################################################
71 # installs the pkgconfig file
72 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
73
74 INSTALL(FILES
75     ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
76     DESTINATION
77     ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig
78     )
79