forked from Samsung/rlottie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
108 lines (84 loc) · 3.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required( VERSION 3.2 )
#declare project
project( rlottie VERSION 0.0.1 LANGUAGES C CXX ASM)
#declare target
add_library( rlottie SHARED "" )
#declare version of the target
set(player_version_major 0)
set(player_version_minor 0)
set(player_version_patch 1)
set(player_version ${player_version_major}.${player_version_minor}.${player_version_patch} )
set_target_properties(rlottie PROPERTIES
VERSION ${player_version}
SOVERSION ${player_version_major}
)
#declare alias so that library can be used inside the build tree, e.g. when testing
add_library(rlottie::rlottie ALIAS rlottie)
#declare target compilation options
target_compile_options(rlottie
PUBLIC
-std=c++14
PRIVATE
-Wall -fvisibility=hidden -O2)
#declare dependancy
set( CMAKE_THREAD_PREFER_PTHREAD TRUE )
find_package( Threads )
target_link_libraries(rlottie
PUBLIC
"${CMAKE_THREAD_LIBS_INIT}"
)
# for dlopen, dlsym and dlclose dependancy
target_link_libraries(rlottie
PRIVATE
${CMAKE_DL_LIBS})
target_link_libraries(rlottie
PUBLIC
"-Wl,--no-undefined"
)
#declare source and include files
add_subdirectory(inc)
add_subdirectory(src)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_DIR ${PREFIX})
SET(LIBDIR ${LIB_INSTALL_DIR})
SET(INCDIR ${PREFIX}/include)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
#install header
install(FILES
inc/rlottie.h
inc/rlottie_capi.h
inc/rlottiecommon.h
DESTINATION include)
#install lib
install( TARGETS rlottie EXPORT rlottie-targets
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
INCLUDES DESTINATION include
)
#install config file.
install( EXPORT rlottie-targets
FILE rlottieTargets.cmake
NAMESPACE rlottie::
DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
#Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/rlottieConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/rlottieConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/rlottieConfig.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
#Install the config, configversion and custom find modules
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/rlottieConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/rlottieConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/cmake/rlottie
)
export(EXPORT rlottie-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/rlottieTargets.cmake NAMESPACE rlottie::)
#Register package in user's package registry
export(PACKAGE rlottie)