-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
135 lines (126 loc) · 2.74 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
cmake_minimum_required(VERSION 3.15)
project(WinToastLibC LANGUAGES C CXX)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(
wintoastlibc
SHARED
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlib.cpp
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlib.h
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.cpp
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h
)
target_link_libraries(
wintoastlibc
shlwapi
user32
advapi32
ole32
)
set_target_properties(
wintoastlibc
PROPERTIES
PUBLIC_HEADER
"${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h"
MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
add_library(
wintoastlibc_lazy
SHARED
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc_lazy.c
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h
)
target_link_libraries(
wintoastlibc_lazy
kernel32
)
set_target_properties(
wintoastlibc_lazy
PROPERTIES
PUBLIC_HEADER
"${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h"
)
add_library(
wintoastlibc_static
STATIC
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlib.cpp
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlib.h
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.cpp
${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h
)
target_compile_definitions(
wintoastlibc_static
PUBLIC
WTLC_BUILD_STATIC
)
target_link_libraries(
wintoastlibc_static
shlwapi
user32
advapi32
ole32
)
set_target_properties(
wintoastlibc_static
PROPERTIES
PUBLIC_HEADER
"${CMAKE_CURRENT_LIST_DIR}/src/wintoastlibc.h"
)
add_executable(
example1
WIN32
${CMAKE_CURRENT_LIST_DIR}/example/example1.c
)
target_include_directories(
example1
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
)
target_link_libraries(
example1
wintoastlibc
ole32
)
add_executable(
example1_lazy
WIN32
${CMAKE_CURRENT_LIST_DIR}/example/example1.c
)
target_include_directories(
example1_lazy
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
)
target_link_libraries(
example1_lazy
wintoastlibc_lazy
ole32
)
add_executable(
example2
WIN32
${CMAKE_CURRENT_LIST_DIR}/example/example2.c
)
target_include_directories(
example2
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
)
target_link_libraries(
example2
wintoastlibc_static
shlwapi
ole32
)
install(
TARGETS wintoastlibc wintoastlibc_static wintoastlibc_lazy example1 example2 example1_lazy
RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/install/bin
ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/install/lib
LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/install/lib
PUBLIC_HEADER DESTINATION ${CMAKE_BINARY_DIR}/install/include
)