-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (41 loc) · 1.44 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
project(rime-sample)
cmake_minimum_required(VERSION 3.10)
set(SAMPLE_VERSION 1.0.0)
set(SAMPLE_SOVERSION 1)
aux_source_directory(src sample_src)
set(sample_library rime-sample)
set(sample_deps ${rime_library})
set(sample_modules "sample")
if(BUILD_SAMPLE)
# to build the sample plugin, console app and tests, set BUILD_SAMPLE=ON
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
message(STATUS "${sample_library} provides modules: ${sample_modules}")
add_library(${sample_library} ${sample_src})
target_link_libraries(${sample_library} ${sample_deps})
set_target_properties(${sample_library}
PROPERTIES
VERSION ${SAMPLE_VERSION}
SOVERSION ${SAMPLE_SOVERSION})
if(XCODE_VERSION)
set_target_properties(${sample_library}
PROPERTIES
INSTALL_NAME_DIR "@rpath")
endif(XCODE_VERSION)
install(TARGETS ${sample_library} DESTINATION ${LIB_INSTALL_DIR})
add_subdirectory(tools)
if(BUILD_TEST)
add_subdirectory(test)
endif()
else()
# to build as a standard Rime plugin, link or copy the directory to plugins/
add_library(rime-sample-objs OBJECT ${sample_src})
if(BUILD_SHARED_LIBS)
set_target_properties(rime-sample-objs
PROPERTIES
POSITION_INDEPENDENT_CODE ON)
endif()
set(plugin_name ${sample_library} PARENT_SCOPE)
set(plugin_objs $<TARGET_OBJECTS:rime-sample-objs> PARENT_SCOPE)
set(plugin_deps ${sample_deps} PARENT_SCOPE)
set(plugin_modules ${sample_modules} PARENT_SCOPE)
endif()