-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
84 lines (62 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
84 lines (62 loc) · 1.83 KB
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
cmake_minimum_required(VERSION 3.6)
project(lightbase_example)
set(CMAKE_C_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# lightbase linux
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include_directories(include)
set(LIGHTBASE_SOURCE src/main.c)
add_library(lightbase_example SHARED ${LIGHTBASE_SOURCE})
target_link_libraries(lightbase_example)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# ------------------------------------------------
# lightbase windows
IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
include_directories(
${CMAKE_SOURCE_DIR}/include
)
link_directories(
${CMAKE_SOURCE_DIR}/lib
)
add_definitions(
-D"_CRT_SECURE_NO_WARNINGS"
-DWIN32_LEAN_AND_MEAN
-D"LIGHTBASE_EXPORTS"
)
add_compile_options(
/diagnostics:column
/FC
/GL
/nologo
/permissive-
/sdl
/utf-8
/Zi
)
add_link_options(
/LTCG
/INCREMENTAL:NO
)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRTD")
# lightbase_example main
file(GLOB_RECURSE SRC_FILES_DIR
${PROJECT_SOURCE_DIR}/src/main.c
)
add_library(lightbase_example SHARED ${SRC_FILES_DIR})
target_link_libraries(lightbase_example win/lightbase
debug "MSVCRTD.lib"
optimized "MSVCRT.lib"
"win/lightbase"
)
set_target_properties(lightbase_example PROPERTIES OUTPUT_NAME "lightbase_example")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")