Various changes relating to build on Fedora Linux.
[platform/core/security/vasum.git] / wrapper / CMakeLists.txt
1 # Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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 # @file   CMakeLists.txt
17 # @author Mateusz Malicki (m.malicki2@samsung.com)
18 #
19
20 PROJECT(vasum)
21 MESSAGE(STATUS "")
22 MESSAGE(STATUS "Generating makefile for the Vasum wrapper...")
23
24 ## set wrapper library sources (without vasum-client.cpp)
25 FILE(GLOB wrapper_SRCS *.cpp *.hpp *.h
26      ${CLIENT_FOLDER}/vasum-client-impl.hpp     ${CLIENT_FOLDER}/vasum-client-impl.cpp
27      ${CLIENT_FOLDER}/host-ipc-connection.hpp   ${CLIENT_FOLDER}/host-ipc-connection.cpp
28      ${CLIENT_FOLDER}/utils.hpp                 ${CLIENT_FOLDER}/utils.cpp)
29
30 FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}/epoll/*.cpp
31                       ${COMMON_FOLDER}/ipc/*.hpp                ${COMMON_FOLDER}/ipc/*.cpp
32                       ${COMMON_FOLDER}/ipc/internals/*.hpp      ${COMMON_FOLDER}/ipc/internals/*.cpp
33                       ${COMMON_FOLDER}/utils/*.hpp              ${COMMON_FOLDER}/utils/*.cpp
34                       ${COMMON_FOLDER}/*.hpp                    ${COMMON_FOLDER}/*.cpp)
35
36 SET(_LIB_VERSION_ "${VERSION}")
37 SET(_LIB_SOVERSION_ "0")
38 SET(PC_FILE "${PROJECT_NAME}.pc")
39
40 ## Set the default ELF image symbol visibility to hidden. Using this feature
41 ## can very substantially improve linking and load times of shared object
42 ## libraries, produce more optimized code, provide near-perfect API export
43 ## and prevent symbol clashes
44 ADD_DEFINITIONS(-fvisibility=hidden)
45 ADD_DEFINITIONS(-D__STDC_FORMAT_MACROS)
46
47 ADD_LIBRARY(${PROJECT_NAME} SHARED ${wrapper_SRCS} ${common_SRCS})
48 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
49         SOVERSION ${_LIB_SOVERSION_}
50         VERSION ${_LIB_VERSION_}
51         COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
52
53 ## Link libraries ##############################################################
54 FIND_PACKAGE(Boost COMPONENTS system filesystem)
55 PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0)
56 INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
57 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
58 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
59 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
60 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
61 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
62                       Config SimpleDbus Ipc)
63
64 ## Generate the pc file ########################################################
65 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
66
67
68 ## Install #####################################################################
69 INSTALL(FILES       ${CMAKE_BINARY_DIR}/${PC_FILE}
70         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
71
72 INSTALL(TARGETS     ${PROJECT_NAME}
73         DESTINATION ${LIB_INSTALL_DIR}
74         COMPONENT   RuntimeLibraries)
75
76 INSTALL(FILES       vasum.h vasum_list.h
77         DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})