2 # Copyright (c) 2016 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 owl...")
28 FILE(GLOB HEADERS ${API_FOLDER}/crypto/*.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_}
48 ## Link libraries ##############################################################
49 PKG_CHECK_MODULES(OWL_DEPS REQUIRED openssl)
51 INCLUDE_DIRECTORIES(${API_FOLDER})
52 INCLUDE_DIRECTORIES(SYSTEM ${OWL_DEPS_INCLUDE_DIRS})
53 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OWL_DEPS_LIBRARIES})
55 ## Generate the pc file ########################################################
56 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
58 ## Install #####################################################################
59 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
60 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
62 INSTALL(TARGETS ${PROJECT_NAME}
63 DESTINATION ${LIB_INSTALL_DIR}
64 COMPONENT RuntimeLibraries)
66 INSTALL(FILES ${HEADERS}
67 DESTINATION ${INCLUDE_INSTALL_DIR}/owl)