d1e82ebd6dcbe3c9978e68ceaeb72944d564964b
[platform/core/security/vasum.git] / libs / logger / 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 Dariusz Michaluk (d.michaluk@samsung.com)
18 #
19
20 PROJECT(Logger)
21
22 MESSAGE(STATUS "")
23 MESSAGE(STATUS "Generating makefile for the libLogger...")
24 FILE(GLOB HEADERS   *.hpp)
25 FILE(GLOB SRCS      *.cpp *.hpp)
26
27 SET(_LIB_VERSION_ "${VERSION}")
28 SET(_LIB_SOVERSION_ "0")
29 SET(PC_FILE "lib${PROJECT_NAME}.pc")
30
31 ## Setup target ################################################################
32 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
33 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
34     SOVERSION   ${_LIB_SOVERSION_}
35     VERSION     ${_LIB_VERSION_}
36 )
37
38 ## Link libraries ##############################################################
39 PKG_CHECK_MODULES(LOGGER_DEPS libsystemd-journal QUIET)
40 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
41 INCLUDE_DIRECTORIES(SYSTEM ${LOGGER_DEPS_INCLUDE_DIRS})
42 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${LOGGER_DEPS_LIBRARIES})
43
44 ## Add constants ###############################################################
45 if(LOGGER_DEPS_FOUND)
46     ADD_DEFINITIONS(-DHAVE_SYSTEMD_JOURNAL=${LOGGER_DEPS_FOUND})
47 endif()
48
49 ## Generate the pc file ########################################################
50 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
51
52 ## Install #####################################################################
53 INSTALL(FILES       ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
54         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
55
56 INSTALL(TARGETS     ${PROJECT_NAME}
57         DESTINATION ${LIB_INSTALL_DIR}
58         COMPONENT   RuntimeLibraries)
59
60 INSTALL(FILES       ${HEADERS}
61         DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/logger)