2 # Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 # Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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
19 # @file CMakeLists.txt
20 # @author Dariusz Michaluk (d.michaluk@samsung.com)
26 MESSAGE(STATUS "Generating makefile for the yaca...")
28 FILE(GLOB HEADERS ${API_FOLDER}/*.h)
29 FILE(GLOB SRCS *.c *.h)
31 SET(_LIB_VERSION_ "${VERSION}")
32 SET(_LIB_SOVERSION_ "0")
33 SET(PC_FILE "${PROJECT_NAME}.pc")
35 ## Set the default ELF image symbol visibility to hidden. Using this feature
36 ## can very substantially improve linking and load times of shared object
37 ## libraries, produce more optimized code, provide near-perfect API export
38 ## and prevent symbol clashes
39 ADD_DEFINITIONS(-fvisibility=hidden)
41 ## Setup target ################################################################
42 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${HEADERS})
43 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
44 SOVERSION ${_LIB_SOVERSION_}
45 VERSION ${_LIB_VERSION_})
47 ## Link libraries ##############################################################
48 PKG_CHECK_MODULES(YACA_DEPS REQUIRED openssl1.1 capi-base-common)
50 FIND_PACKAGE (Threads)
52 INCLUDE_DIRECTORIES(${API_FOLDER})
53 INCLUDE_DIRECTORIES(SYSTEM ${YACA_DEPS_INCLUDE_DIRS})
54 TARGET_LINK_LIBRARIES(${PROJECT_NAME}
55 ${YACA_DEPS_LIBRARIES}
56 ${CMAKE_THREAD_LIBS_INIT})
58 ## Generate the pc file ########################################################
59 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
61 ## Install #####################################################################
62 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
63 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
65 INSTALL(TARGETS ${PROJECT_NAME}
66 DESTINATION ${LIB_INSTALL_DIR}
67 COMPONENT RuntimeLibraries)
69 INSTALL(FILES ${HEADERS}
70 DESTINATION ${INCLUDE_INSTALL_DIR}/yaca)