Various changes relating to build on Fedora Linux.
[platform/core/security/vasum.git] / libs / config / 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(Config)
21
22 MESSAGE(STATUS "")
23 MESSAGE(STATUS "Generating makefile for the libConfig...")
24 FILE(GLOB HEADERS           *.hpp)
25 FILE(GLOB HEADERS_SQLITE3   ${CMAKE_CURRENT_BINARY_DIR}/sqlite3/*.hpp)
26 FILE(GLOB_RECURSE SRCS      *.cpp *.hpp)
27
28 SET(_LIB_VERSION_ "${VERSION}")
29 SET(_LIB_SOVERSION_ "0")
30 SET(PC_FILE "lib${PROJECT_NAME}.pc")
31
32 ## Setup target ################################################################
33 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
34 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
35     SOVERSION   ${_LIB_SOVERSION_}
36     VERSION     ${_LIB_VERSION_}
37 )
38
39 ## Link libraries ##############################################################
40 PKG_CHECK_MODULES(CONFIG_DEPS REQUIRED sqlite3 glib-2.0)
41 PKG_SEARCH_MODULE(JSON_C json json-c)
42
43 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
44 INCLUDE_DIRECTORIES(SYSTEM ${CONFIG_DEPS_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
45 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${CONFIG_DEPS_LIBRARIES} ${JSON_C_LIBRARIES})
46
47 ## Generate the pc file ########################################################
48 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
49
50 ## Install #####################################################################
51 INSTALL(FILES       ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
52         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
53
54 INSTALL(TARGETS     ${PROJECT_NAME}
55         DESTINATION ${LIB_INSTALL_DIR}
56         COMPONENT   RuntimeLibraries)
57
58 INSTALL(FILES       ${HEADERS}
59         DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/config)
60
61 INSTALL(FILES       ${HEADERS_SQLITE3}
62         DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/config/sqlite3)