lottie: support library version in cmake build system.
[platform/core/uifw/lottie-player.git] / CMakeLists.txt
1 cmake_minimum_required( VERSION 3.2 )
2
3 #declare project
4 project( lottie-player LANGUAGES C CXX )
5
6 #declare target
7 add_library( lottie-player SHARED  "" )
8
9 #declare version of the target
10 set(player_version_major 0)
11 set(player_version_minor 0)
12 set(player_version_patch 1)
13 set(player_version ${player_version_major}.${player_version_minor}.${player_version_patch} )
14 set_target_properties(lottie-player PROPERTIES
15                         VERSION    ${player_version}
16                         SOVERSION  ${player_version_major}
17                       )
18
19 #declare alias so that library can be used inside the build tree, e.g. when testing
20 add_library(lottie-player::lottie-player ALIAS lottie-player)
21
22 #declare target compilation options
23 target_compile_options(lottie-player
24                     PUBLIC
25                         -std=c++11
26                     PRIVATE
27                         -Wall -fvisibility=hidden)
28
29 #declare dependancy
30 set( CMAKE_THREAD_PREFER_PTHREAD TRUE )
31 find_package( Threads )
32
33 target_link_libraries(lottie-player
34                     PUBLIC
35                         "${CMAKE_THREAD_LIBS_INIT}"
36                      )
37
38 #declare source and include files
39 add_subdirectory(inc)
40 add_subdirectory(src)
41
42 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
43 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
44
45 #install header
46 install(FILES inc/lottieplayer.h DESTINATION include)
47
48 #install lib
49 install( TARGETS lottie-player EXPORT lottie-player-targets
50          LIBRARY     DESTINATION    lib
51          ARCHIVE     DESTINATION    lib
52          INCLUDES    DESTINATION    include
53        )
54
55 #install config file.
56 install( EXPORT lottie-player-targets
57          FILE          lottie-player.cmake
58          NAMESPACE     lottie-player::
59          DESTINATION   lib/cmake/lottie-player
60        )
61
62
63 #Register package in user's package registry
64 export(PACKAGE lottie-player)