Remove unnecessary code for smack.
[sdk/target/sdbd.git] / CMakeLists.txt
1 # Copyright (c) 2014 Samsung Electronics Co., Ltd
2 #
3 # Licensed under the Apache License, Version 2.0 (the License);
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an AS IS BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 cmake_minimum_required (VERSION 2.8.3)
17 project (sdbd)
18
19 option(USE_FUNCTION_FS "Use FunctionFS" NO)
20 option(BUILD_UNIT_TESTS "Build unit tests" NO)
21
22 set(sdbd_SRCS
23         src/sdb.c
24         src/fdevent.c
25         src/transport.c
26         src/transport_local.c
27         src/transport_usb.c
28         src/sockets.c
29         src/services.c
30         src/file_sync_service.c
31         src/utils.c
32         src/socket_inaddr_any_server.c
33         src/socket_local_client.c
34         src/socket_local_server.c
35         src/socket_loopback_client.c
36         src/socket_loopback_server.c
37         src/socket_network_client.c
38         src/properties.c
39         src/sdktools.c
40         src/strutils.c
41         src/init.c
42         src/fileutils.c
43         src/commandline_sdbd.c
44         src/usb_linux_client.c
45         src/usb_funcfs_client.c
46 )
47
48 include_directories(src)
49
50 add_executable(sdbd ${sdbd_SRCS})
51
52 set_property(
53         TARGET sdbd
54         PROPERTY COMPILE_DEFINITIONS
55         SDB_HOST=0
56         _DROP_PRIVILEGE
57         _FILE_OFFSET_BITS=64
58 )
59
60 set_property(
61         TARGET sdbd
62         APPEND PROPERTY COMPILE_DEFINITIONS
63         _XOPEN_SOURCE
64         _GNU_SOURCE
65         HAVE_FORKEXEC
66 )
67
68 if(USE_FUNCTION_FS)
69         set_property(
70                 TARGET sdbd
71                 APPEND PROPERTY COMPILE_DEFINITIONS
72                 USB_FUNCFS
73         )
74 endif()
75
76 ADD_DEFINITIONS("-fPIE")
77
78 include(FindPkgConfig)
79
80 # Get capi-system-info
81 pkg_check_modules(CAPI_SYSTEM_INFO REQUIRED capi-system-info libtzplatform-config)
82 include_directories(${CAPI_SYSTEM_INFO_INCLUDE_DIRS})
83
84 # Get pthreads
85 find_package(Threads REQUIRED)
86
87 # Add libraries (-l...)
88 target_link_libraries (sdbd -pie -lsmack ${CMAKE_THREAD_LIBS_INIT} ${CAPI_SYSTEM_INFO_LDFLAGS})
89
90 install(TARGETS sdbd DESTINATION /usr/sbin)
91 install(FILES script/sdbd DESTINATION /etc/init.d)
92
93
94 # Optionally build unit tests binary -- could be helpful during further development
95 if(BUILD_UNIT_TESTS)
96         enable_testing()
97         add_subdirectory(test)
98 endif()