forked from sahlberg/libsmb2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
221 lines (187 loc) · 6.24 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
if(NOT ESP_PLATFORM)
if(PICO_BOARD)
cmake_minimum_required(VERSION 3.12)
message(STATUS "Configuring libsmb2 for ${PICO_BOARD}")
project(libsmb2 C CXX ASM)
add_library(libsmb2 STATIC
lib/aes.c
lib/aes128ccm.c
lib/alloc.c
lib/dcerpc.c
lib/dcerpc-lsa.c
lib/dcerpc-srvsvc.c
lib/errors.c
lib/init.c
lib/hmac.c
lib/hmac-md5.c
lib/krb5-wrapper.c
lib/libsmb2.c
lib/md4c.c
lib/md5.c
lib/ntlmssp.c
lib/pdu.c
lib/sha1.c
lib/sha224-256.c
lib/sha384-512.c
lib/smb2-cmd-close.c
lib/smb2-cmd-create.c
lib/smb2-cmd-echo.c
lib/smb2-cmd-error.c
lib/smb2-cmd-flush.c
lib/smb2-cmd-ioctl.c
lib/smb2-cmd-logoff.c
lib/smb2-cmd-negotiate.c
lib/smb2-cmd-query-directory.c
lib/smb2-cmd-query-info.c
lib/smb2-cmd-read.c
lib/smb2-cmd-session-setup.c
lib/smb2-cmd-set-info.c
lib/smb2-cmd-tree-connect.c
lib/smb2-cmd-tree-disconnect.c
lib/smb2-cmd-write.c
lib/smb2-data-file-info.c
lib/smb2-data-filesystem-info.c
lib/smb2-data-security-descriptor.c
lib/smb2-data-reparse-point.c
lib/smb2-share-enum.c
lib/smb3-seal.c
lib/smb2-signing.c
lib/socket.c
lib/sync.c
lib/timestamps.c
lib/unicode.c
lib/usha.c
lib/compat.c
)
include_directories(libsmb2 STATIC
${PICO_SDK_PATH}/lib/lwip/src/include
${PICO_SDK_PATH}/src/rp2_common/pico_lwip/include
lib
include
include/smb2
include/picow
)
##### EMD PICO_BOARD
else() ##### DEFAULT
cmake_minimum_required(VERSION 3.2)
project(libsmb2
LANGUAGES C
VERSION 4.0.0
)
set(SOVERSION 1 CACHE STRING "" FORCE)
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/libsmb2" CACHE PATH "Installation directory for cmake (.cmake) files")
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ENABLE_EXAMPLES "Build example programs" OFF)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
find_package(GSSAPI)
if(GSSAPI_FOUND)
add_definitions(-DHAVE_LIBKRB5)
endif()
include(cmake/ConfigureChecks.cmake)
include_directories(${CMAKE_CURRENT_BINARY_DIR}
include
include/smb2
)
set(core_DEPENDS ${GSSAPI_LIBRARIES} CACHE STRING "" FORCE)
if(MSVC AND BUILD_SHARED_LIBS)
# If we are building dll with msvc, then generate a def file according to the syms file
SET(SYMS_FILE_PATH "${PROJECT_SOURCE_DIR}/lib/libsmb2.syms")
SET(DEF_FILE_PATH "${PROJECT_BINARY_DIR}/lib/libsmb2.def")
file(READ ${SYMS_FILE_PATH} EXPORT_SYMBOLS)
file(WRITE ${DEF_FILE_PATH} "LIBRARY smb2\nEXPORTS\n\n${EXPORT_SYMBOLS}")
# Pass def file to the linker
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${DEF_FILE_PATH}")
endif()
if(CMAKE_SYSTEM_NAME MATCHES Windows)
list(APPEND CORE_LIBRARIES ws2_32.lib)
add_definitions(-DWIN32_LEAN_AND_MEAN -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
include_directories(include/msvc)
elseif(CMAKE_SYSTEM_NAME STREQUAL Solaris)
find_library(SOCKET_LIBRARY socket)
find_library(NSL_LIBRARY nsl)
list(APPEND CORE_LIBRARIES ${SOCKET_LIBRARY} ${NSL_LIBRARY})
endif()
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
add_subdirectory(lib)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/libsmb2-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
configure_file(cmake/libsmb2.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libsmb2.pc @ONLY)
install(DIRECTORY include/smb2
DESTINATION ${INSTALL_INC_DIR})
install(FILES cmake/FindSMB2.cmake
${CMAKE_CURRENT_BINARY_DIR}/libsmb2-config-version.cmake
DESTINATION ${INSTALL_CMAKE_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsmb2.pc
DESTINATION ${INSTALL_PKGCONFIG_DIR})
endif() ### DEFAULT
else() ##### ESP_PLATFORM
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
add_definitions(-DHAVE_CONFIG_H)
endif()
set(COMPONENT_ADD_INCLUDEDIRS
"lib"
include
include/smb2
include/esp
)
set(COMPONENT_SRCS
lib/aes.c
lib/aes128ccm.c
lib/alloc.c
lib/dcerpc.c
lib/dcerpc-lsa.c
lib/dcerpc-srvsvc.c
lib/errors.c
lib/init.c
lib/hmac.c
lib/hmac-md5.c
lib/krb5-wrapper.c
lib/libsmb2.c
lib/md4c.c
lib/md5.c
lib/ntlmssp.c
lib/pdu.c
lib/sha1.c
lib/sha224-256.c
lib/sha384-512.c
lib/smb2-cmd-close.c
lib/smb2-cmd-create.c
lib/smb2-cmd-echo.c
lib/smb2-cmd-error.c
lib/smb2-cmd-flush.c
lib/smb2-cmd-ioctl.c
lib/smb2-cmd-logoff.c
lib/smb2-cmd-negotiate.c
lib/smb2-cmd-query-directory.c
lib/smb2-cmd-query-info.c
lib/smb2-cmd-read.c
lib/smb2-cmd-session-setup.c
lib/smb2-cmd-set-info.c
lib/smb2-cmd-tree-connect.c
lib/smb2-cmd-tree-disconnect.c
lib/smb2-cmd-write.c
lib/smb2-data-file-info.c
lib/smb2-data-filesystem-info.c
lib/smb2-data-security-descriptor.c
lib/smb2-data-reparse-point.c
lib/smb2-share-enum.c
lib/smb3-seal.c
lib/smb2-signing.c
lib/socket.c
lib/sync.c
lib/timestamps.c
lib/unicode.c
lib/usha.c
lib/compat.c
)
set(COMPONENT_NAME ".")
register_component()
endif() ##### ESP_PLATFORM