cleanup: removes legacy-named file
[src/app-framework-binder.git] / CMakeLists.txt
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
3 #
4 # author: José Bollo <jose.bollo@iot.bzh>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
18
19 PROJECT(afb-daemon C)
20
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
22 SET(CMAKE_BUILD_TYPE Debug)
23 SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
24
25 SET(PROJECT_NAME "AFB Daemon")
26 SET(PROJECT_PRETTY_NAME "Application Framework Binder Daemon")
27 SET(PROJECT_DESCRIPTION "Secured binder of API for clients of the Application framework")
28 SET(PROJECT_VERSION "1.0")
29 SET(PROJECT_URL "https://github.com/iotbzh/afb-daemon")
30
31 SET(LIBAFBWSC_VERSION "1.0")
32 SET(LIBAFBWSC_SOVERSION "1")
33
34 INCLUDE(FindPkgConfig)
35 INCLUDE(CheckIncludeFiles)
36 INCLUDE(CheckLibraryExists)
37 INCLUDE(GNUInstallDirs)
38
39 ###########################################################################
40
41 link_libraries(-Wl,--as-needed -Wl,--gc-sections)
42
43 add_compile_options(-Wall -Wextra -Wconversion)
44 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
45 add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
46 add_compile_options(-Werror=maybe-uninitialized)
47 add_compile_options(-Werror=implicit-function-declaration)
48 add_compile_options(-ffunction-sections -fdata-sections)
49 add_compile_options(-fPIC)
50 add_compile_options(-g)
51
52 set(CMAKE_C_FLAGS_PROFILING    "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
53 set(CMAKE_C_FLAGS_DEBUG        "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
54 set(CMAKE_C_FLAGS_RELEASE      "-g -O2")
55 set(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
56
57 ###########################################################################
58
59 IF(CMAKE_BUILD_TYPE MATCHES Debug)
60   CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
61   IF(HAVE_LIBEFENCE)
62     MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
63     SET(libefence_LIBRARIES "-lefence")
64   ENDIF(HAVE_LIBEFENCE)
65 ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
66
67 PKG_CHECK_MODULES(json-c REQUIRED json-c)
68
69 INCLUDE(FindThreads)
70 FIND_PACKAGE(Threads)
71
72 SET(include_dirs
73         ${INCLUDE_DIRS}
74         ${CMAKE_SOURCE_DIR}/include
75         ${json-c_INCLUDE_DIRS}
76         )
77
78 SET(link_libraries
79         ${libefence_LIBRARIES}
80         ${CMAKE_THREAD_LIBS_INIT}
81         ${json-c_LIBRARIES}
82         )
83
84 SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
85
86 ADD_SUBDIRECTORY(src)
87 ADD_SUBDIRECTORY(include)
88 ADD_SUBDIRECTORY(bindings)
89
90 ############################################################
91 # installs the pkgconfig files
92 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
93 CONFIGURE_FILE(libafbwsc.pc.in libafbwsc.pc @ONLY)
94
95 INSTALL(FILES
96     ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
97     ${CMAKE_CURRENT_BINARY_DIR}/libafbwsc.pc
98     DESTINATION
99     ${CMAKE_INSTALL_LIBDIR}/pkgconfig
100     )
101