-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
83 lines (65 loc) · 1.79 KB
/
Copy pathCMakeLists.txt
File metadata and controls
83 lines (65 loc) · 1.79 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
cmake_minimum_required(VERSION 3.21)
option(GENERATE_UNION_API_LIB "This option generates Union API static library target. By default this option is set to ON" ON)
option(GENERATE_UNION_API_DLL "This option generates Union API dynamic library target. By default this option is set to OFF" OFF)
option(GENERATE_UNION_API_EXE "This option generates Union API executable target. By default this option is set to OFF" OFF)
project(UnionAPI)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
file(GLOB_RECURSE SRC
"union-api/*.h"
"union-api/*.cpp"
)
list(REMOVE_ITEM SRC
"${CMAKE_CURRENT_SOURCE_DIR}/union-api/Union/Memory.cpp"
)
## Union API static lib
if (GENERATE_UNION_API_LIB)
add_library(union_api_lib STATIC ${SRC})
target_sources(union_api_lib
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/union-api/Union/Memory.cpp"
${SRC}
)
target_compile_definitions(union_api_lib
PUBLIC
_UNION_API_LIB
PRIVATE
_UNION_API_BUILD
)
target_include_directories(union_api_lib PUBLIC "union-api/")
endif()
# Union API dynamic lib
if (GENERATE_UNION_API_DLL)
add_library(union_api_dll SHARED)
target_sources(union_api_dll
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/union-api/Union/Memory.cpp"
PRIVATE
${SRC}
)
target_compile_definitions(union_api_dll
PUBLIC
_UNION_API_DLL
PRIVATE
_UNION_API_BUILD
)
target_include_directories(union_api_dll PUBLIC "union-api/")
endif()
## Union API executable
if (GENERATE_UNION_API_EXE)
add_executable(union_api_exe)
target_sources(union_api_exe
PRIVATE
${SRC}
"${CMAKE_CURRENT_SOURCE_DIR}/union-api/Union/Memory.cpp"
)
target_compile_definitions(union_api_exe
PUBLIC
_UNION_API_EXE
PRIVATE
_UNION_API_BUILD
)
target_include_directories(union_api_exe PUBLIC "union-api/")
endif()
# dependencies
add_subdirectory(dependencies)