-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
58 lines (54 loc) · 1.64 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
cmake_minimum_required(VERSION 3.22)
project(
libmterm
VERSION 0.1.0
DESCRIPTION "A mini pseudo-terminal implementation library."
HOMEPAGE_URL "https://github.com/zakiaatot/libmterm"
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
include_directories(${PROJECT_SOURCE_DIR}/include)
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
if(NOT DEFINED TARGET)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TARGET "linux")
elseif(ANDROID)
set(TARGET "android")
else()
set(TARGET "unkonwn")
endif()
endif()
if(${TARGET} STREQUAL "linux")
add_definitions(-DTARGET_LINUX)
include_directories(${PROJECT_SOURCE_DIR}/jni/linux)
add_library(mterm SHARED ${SRC})
set_target_properties(
mterm
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output/linux
)
add_library(mterm_static STATIC ${SRC})
set_target_properties(
mterm_static
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output/linux
)
elseif(${TARGET} STREQUAL "android")
add_definitions(-DTARGET_ANDROID)
include_directories(${PROJECT_SOURCE_DIR}/jni/android)
add_library(mterm SHARED ${SRC})
set_target_properties(
mterm
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output/android/${ANDROID_ABI}
)
add_library(mterm_static STATIC ${SRC})
set_target_properties(
mterm_static
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output/android/${ANDROID_ABI}
)
else()
message(FATAL_ERROR "Only support for Android and Linux now!")
endif()