-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathCMakeLists.txt
509 lines (441 loc) · 19.3 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
cmake_minimum_required(VERSION 3.16)
if(POLICY CMP0025)
# detect Apple's Clang
cmake_policy(SET CMP0025 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
set(LIB_MAJOR_VERSION "1")
set(LIB_MINOR_VERSION "0")
set(LIB_PATCH_VERSION "0")
set(LIB_TWEAK_VERSION "0")
set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}.${LIB_TWEAK_VERSION}")
# Without this, paths are not relative in the sources list
cmake_policy(SET CMP0076 NEW)
project(lspcpp VERSION "${LIB_VERSION_STRING}" LANGUAGES CXX C)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(GOOGLETEST_VERSION "0.00")
# compile in RelWithDebInfo mode by default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
set(LSPCPP_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.")
# Set LSPCPP_LIB_NAME for pkg-config lspcpp.pc. We cannot use the OUTPUT_NAME target
# property because it's not set by default.
set(LSPCPP_LIB_NAME lspcpp)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(LSPCPP_LIB_NAME ${LSPCPP_LIB_NAME}${LSPCPP_DEBUG_POSTFIX})
endif ()
include(CMakeParseArguments)
# Joins arguments and places the results in ${result_var}.
function(join result_var)
set(result "")
foreach (arg ${ARGN})
set(result "${result}${arg}")
endforeach ()
set(${result_var} "${result}" PARENT_SCOPE)
endfunction()
# Sets a cache variable with a docstring joined from multiple arguments:
# set(<variable> <value>... CACHE <type> <docstring>...)
# This allows splitting a long docstring for readability.
function(set_verbose)
# cmake_parse_arguments is broken in CMake 3.4 (cannot parse CACHE) so use
# list instead.
list(GET ARGN 0 var)
list(REMOVE_AT ARGN 0)
list(GET ARGN 0 val)
list(REMOVE_AT ARGN 0)
list(REMOVE_AT ARGN 0)
list(GET ARGN 0 type)
list(REMOVE_AT ARGN 0)
join(doc ${ARGN})
set(${var} ${val} CACHE ${type} ${doc})
endfunction()
###########################################################
# Options
###########################################################
function (option_if_not_defined name description default)
if(NOT DEFINED ${name})
option(${name} ${description} ${default})
endif()
endfunction()
option_if_not_defined(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git submodule if exists" OFF)
option_if_not_defined(LSPCPP_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
option_if_not_defined(LSPCPP_BUILD_EXAMPLES "Build example applications" OFF)
option_if_not_defined(LSPCPP_BUILD_FUZZER "Build fuzzer" OFF)
option_if_not_defined(LSPCPP_BUILD_WEBSOCKETS "Build websocket server" ON)
option_if_not_defined(LSPCPP_ASAN "Build lsp with address sanitizer" OFF)
option_if_not_defined(LSPCPP_MSAN "Build lsp with memory sanitizer" OFF)
option_if_not_defined(LSPCPP_TSAN "Build lsp with thread sanitizer" OFF)
option_if_not_defined(LSPCPP_INSTALL "Create lsp install target" OFF)
option_if_not_defined(LSPCPP_SUPPORT_BOEHM_GC "\
Enable support for Boehm GC. GC must be specified LSPCPP_GC_DOWNLOADED_ROOT, if downloaded or by
find_package(BDWgc CONFIG REQUIRED) or pkg_config." OFF)
option_if_not_defined(LSPCPP_USE_CPP17 "Use C++17 for compilation. Setting this to off requires boost-optional." OFF)
set(LSPCPP_GC_DOWNLOADED_ROOT "" CACHE STRING "\
If using downloaded gc root from https://www.hboehm.info/gc/, extract its contents and set this setting to
where the tar.gz file is extracted to. This directory must be an absolute path.
If this setting is set, LspCpp will use downloaded GC regardless of whether GC from find_package or
pkg_config is available or not.
")
option_if_not_defined(LSPCPP_GC_STATIC "Compiling with static gc library. Only used if a custom GC root is given" OFF)
set(LSPCPP_WIN32_WINNT_VALUE "0x0A00" CACHE STRING
"Value to specify for _WIN32_WINNT macro when compiling on windows. See
https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170"
)
###########################################################
# Boehm GC
###########################################################
if (LSPCPP_SUPPORT_BOEHM_GC AND NOT LSPCPP_GC_DOWNLOADED_ROOT)
message(STATUS "Attempting to find BDWgc by find_package")
find_package(BDWgc CONFIG)
if (NOT BDWgc_FOUND)
set(GC_USE_PKGCONFIG 1)
# fallback to pkg-config
message(STATUS "CMake config for BDWgc not found; falling back to pkg-config")
find_package(PkgConfig REQUIRED)
pkg_check_modules(gc REQUIRED IMPORTED_TARGET bdw-gc)
endif()
endif()
###########################################################
# Directories
###########################################################
function (set_if_not_defined name value)
if(NOT DEFINED ${name})
set(${name} ${value} PARENT_SCOPE)
endif()
endfunction()
set(LSPCPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set_if_not_defined(LSPCPP_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
macro(lspcpp_set_target_options_with_nuget_pkg target id version)
if (CMAKE_GENERATOR MATCHES "Visual Studio.*")
if(EXISTS ${CMAKE_BINARY_DIR}/packages/${id}.${version}/build/${id}.targets)
target_link_libraries(${target} PRIVATE ${CMAKE_BINARY_DIR}/packages/${id}.${version}/build/${id}.targets)
elseif(EXISTS ${CMAKE_BINARY_DIR}/packages/${id}.${version}/build/native/${id}.targets)
target_link_libraries(${target} PRIVATE ${CMAKE_BINARY_DIR}/packages/${id}.${version}/build/native/${id}.targets)
else()
message(FATAL_ERROR "Can't find target of ${id}.${version}")
endif()
else()
message(FATAL_ERROR "NUGET package only use in Visual Studio")
endif()
endmacro()
macro(INSTALL_NUGET id version)
if (CMAKE_GENERATOR MATCHES "Visual Studio.*")
unset(nuget_cmd)
list(APPEND nuget_cmd install ${id} -Prerelease -Version ${version} -OutputDirectory ${CMAKE_BINARY_DIR}/packages)
message("excute nuget install:${nuget_cmd}")
execute_process(COMMAND nuget ${nuget_cmd} ENCODING AUTO)
else()
message(FATAL_ERROR "INSTALL_NUGET only use in Visual Studio")
endif()
endmacro()
###########################################################
# Functions
###########################################################
function(lspcpp_set_target_options target)
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
# Enable C++14/17 (Required)
if (LSPCPP_USE_CPP17)
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
else()
set_property(TARGET ${target} PROPERTY CXX_STANDARD 14)
endif()
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS OFF)
if (CMAKE_GENERATOR MATCHES "Visual Studio.*")
lspcpp_set_target_options_with_nuget_pkg(${target} boost 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_chrono-vc141 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_date_time-vc141 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_filesystem-vc141 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_program_options-vc141 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_system-vc141 1.76.0.0)
lspcpp_set_target_options_with_nuget_pkg(${target} boost_thread-vc141 1.76.0.0)
endif()
# Enable all warnings
if(MSVC)
target_compile_options(${target} PRIVATE "-W4")
else()
target_compile_options(${target} PRIVATE "-Wall")
endif()
# Disable specific, pedantic warnings
if(MSVC)
target_compile_options(${target} PRIVATE
"-D_CRT_SECURE_NO_WARNINGS"
# Warnings from nlohmann/json headers.
"/wd4267" # 'argument': conversion from 'size_t' to 'int', possible loss of data
"/bigobj" # for visual studio 2022 x64 or later.
)
endif()
# Add define for JSON library in use
set_target_properties(${target} PROPERTIES
COMPILE_DEFINITIONS "LSPCPP_JSON_${LSPCPP_JSON_LIBRARY_UPPER}=1"
)
# Treat all warnings as errors
if(LSPCPP_WARNINGS_AS_ERRORS)
if(MSVC)
target_compile_options(${target} PRIVATE "/WX")
else()
target_compile_options(${target} PRIVATE "-Werror")
endif()
endif(LSPCPP_WARNINGS_AS_ERRORS)
if(LSPCPP_ASAN)
target_compile_options(${target} PUBLIC "-fsanitize=address")
target_link_libraries(${target} PUBLIC "-fsanitize=address")
elseif(LSPCPP_MSAN)
target_compile_options(${target} PUBLIC "-fsanitize=memory")
target_link_libraries(${target} PUBLIC "-fsanitize=memory")
elseif(LSPCPP_TSAN)
target_compile_options(${target} PUBLIC "-fsanitize=thread")
target_link_libraries(${target} PUBLIC "-fsanitize=thread")
endif()
# Error on undefined symbols
# if(NOT MSVC)
# target_compile_options(${target} PRIVATE "-Wl,--no-undefined")
# endif()
if (LSPCPP_SUPPORT_BOEHM_GC)
if (LSPCPP_GC_DOWNLOADED_ROOT)
message(STATUS "Using manually downloaded GC")
target_include_directories(${target} PUBLIC ${LSPCPP_GC_DOWNLOADED_ROOT}/include)
if (LSPCPP_GC_STATIC)
target_compile_definitions(${target} PUBLIC GC_NOT_DLL)
endif()
else()
if (NOT GC_USE_PKGCONFIG)
message(STATUS "Using cmake config for locating gc")
target_link_libraries(${target} PUBLIC BDWgc::gc)
get_target_property(GC_INCLUDE_DIRS_BASE BDWgc::gc INTERFACE_INCLUDE_DIRECTORIES)
else()
message(STATUS "Using pkg-config for locating gc")
target_link_libraries(${target} PUBLIC PkgConfig::gc)
get_target_property(GC_INCLUDE_DIRS_BASE PkgConfig::gc INTERFACE_INCLUDE_DIRECTORIES)
endif()
if (NOT GC_INCLUDE_DIRS_BASE STREQUAL "GC_INCLUDE_DIRS_BASE-NOTFOUND")
list(TRANSFORM GC_INCLUDE_DIRS_BASE APPEND /gc)
target_include_directories(${target} PUBLIC ${GC_INCLUDE_DIRS_BASE})
else()
message(WARNING "Cannot find GC include directories; compilation may not work")
endif()
endif()
target_compile_definitions(${target} PUBLIC LSPCPP_USEGC)
endif()
if (WIN32)
target_compile_definitions(${target} PRIVATE _WIN32_WINNT=${LSPCPP_WIN32_WINNT_VALUE})
endif()
endfunction()
# Libraries
if (MSVC)
set(Uri_USE_STATIC_CRT OFF)
endif()
set(Uri_BUILD_TESTS OFF)
add_subdirectory(third_party/uri)
###########################################################
# boost library
###########################################################
if (CMAKE_GENERATOR MATCHES "Visual Studio.*")
INSTALL_NUGET(boost 1.76.0.0)
INSTALL_NUGET(boost_chrono-vc141 1.76.0.0)
INSTALL_NUGET(boost_date_time-vc141 1.76.0.0)
INSTALL_NUGET(boost_filesystem-vc141 1.76.0.0)
INSTALL_NUGET(boost_program_options-vc141 1.76.0.0)
INSTALL_NUGET(boost_system-vc141 1.76.0.0)
INSTALL_NUGET(boost_thread-vc141 1.76.0.0)
else()
find_package(Boost CONFIG COMPONENTS date_time chrono filesystem system thread program_options)
if(NOT Boost_FOUND)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(FATAL_ERROR "Can't find boost,lease build boost and install it or install boost with : brew install boost")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
message(FATAL_ERROR "Can't find boost,please build boost and install it. or install boost with : sudo apt-get install libboost-dev")
else()
message(FATAL_ERROR "Boost not found. Please ensure boost is available for CMake.")
endif()
endif()
endif()
###########################################################
# JSON library
###########################################################
if(USE_SYSTEM_RAPIDJSON)
set(RapidJSON_MIN_VERSION "1.1.0")
find_package(RapidJSON ${RapidJSON_MIN_VERSION} QUIET)
if(NOT DEFINED RapidJSON_INCLUDE_DIRS AND DEFINED RAPIDJSON_INCLUDE_DIRS)
set(RapidJSON_INCLUDE_DIRS "${RAPIDJSON_INCLUDE_DIRS}")
endif()
endif()
if(NOT RapidJSON_FOUND)
if(EXISTS "${PROJECT_SOURCE_DIR}/third_party/rapidjson/include")
message(STATUS "Using local RapidJSON")
set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include)
else()
message(STATUS "Please initialize rapidJSON git submodule as currently installed version is to old:")
message(STATUS "git submodule init && git submodule update")
message(FATAL_ERROR "RapidJSON version is likely too old.")
endif()
endif()
###########################################################
# Targets
###########################################################
# lsp
add_library(lspcpp STATIC)
set (LSP_INCLUDE_LIST ${LSPCPP_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${RapidJSON_INCLUDE_DIRS}
${Uri_SOURCE_DIR}/include)
### Includes
target_include_directories(lspcpp PRIVATE ${LSP_INCLUDE_LIST})
target_link_libraries(lspcpp PUBLIC network-uri ${Boost_LIBRARIES})
set(LSPCPP_THIRD_PARTY_DIR_LIST
${LSPCPP_THIRD_PARTY_DIR}/utfcpp/source
)
foreach(include_dir ${LSPCPP_THIRD_PARTY_DIR_LIST})
get_filename_component(include_dir_realpath ${include_dir} REALPATH)
# Don't add as SYSTEM if they are in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES.
# It would reorder the system search paths and cause issues with libstdc++'s
# use of #include_next.
if(NOT "${include_dir_realpath}" IN_LIST CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES)
target_include_directories(lspcpp SYSTEM PRIVATE ${include_dir})
endif()
endforeach()
### Sources
set(JSONRPC_LIST
src/jsonrpc/Context.cpp
src/jsonrpc/Endpoint.cpp
src/jsonrpc/GCThreadContext.cpp
src/jsonrpc/message.cpp
src/jsonrpc/MessageJsonHandler.cpp
src/jsonrpc/RemoteEndPoint.cpp
src/jsonrpc/serializer.cpp
src/jsonrpc/StreamMessageProducer.cpp
src/jsonrpc/TcpServer.cpp
src/jsonrpc/threaded_queue.cpp
)
set(LSPCPP_LIST
src/lsp/initialize.cpp
src/lsp/lsp.cpp
src/lsp/lsp_diagnostic.cpp
src/lsp/Markup.cpp
src/lsp/ParentProcessWatcher.cpp
src/lsp/ProtocolJsonHandler.cpp
src/lsp/textDocument.cpp
src/lsp/utils.cpp
src/lsp/working_files.cpp
)
if(LSPCPP_BUILD_WEBSOCKETS)
set(JSONRPC_LIST
${JSONRPC_LIST}
src/jsonrpc/WebSocketServer.cpp
)
endif()
target_sources(lspcpp PRIVATE
${JSONRPC_LIST}
${LSPCPP_LIST})
### Compile options
lspcpp_set_target_options(lspcpp)
set_target_properties(lspcpp PROPERTIES POSITION_INDEPENDENT_CODE 1)
set_target_properties(lspcpp PROPERTIES
DEBUG_POSTFIX "${LSPCPP_DEBUG_POSTFIX}"
# Workaround for Visual Studio 2017:
# Ensure the .pdb is created with the same name and in the same directory
# as the .lib. Newer VS versions already do this by default, but there is no
# harm in setting it for those too. Ignored by other generators.
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
COMPILE_PDB_NAME "lspcpp"
COMPILE_PDB_NAME_DEBUG "lspcpp${LSPCPP_DEBUG_POSTFIX}")
# install
if(LSPCPP_INSTALL)
include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/JoinPaths.cmake)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(targets_export_name lspcpp-targets)
set(project_config ${PROJECT_BINARY_DIR}/lspcpp-config.cmake)
set(version_config ${PROJECT_BINARY_DIR}/lspcpp-config-version.cmake)
set(pkgconfig ${PROJECT_BINARY_DIR}/lspcpp.pc)
set_verbose(LSPCPP_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
"Installation directory for libraries, a relative path that "
"will be joined to ${CMAKE_INSTALL_PREFIX} or an absolute path.")
set_verbose(LSPCPP_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE STRING
"Installation directory for pkgconfig (.pc) files, a relative "
"path that will be joined with ${CMAKE_INSTALL_PREFIX} or an "
"absolute path.")
set_verbose(LSPCPP_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/lspcpp CACHE STRING
"Installation directory for cmake files, a relative path that "
"will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute "
"path.")
configure_package_config_file(
${PROJECT_SOURCE_DIR}/support/cmake/lspcpp-config.cmake.in
${project_config}
INSTALL_DESTINATION ${LSPCPP_CMAKE_DIR} )
write_basic_package_version_file(
${version_config}
VERSION ${LIB_VERSION_STRING}
COMPATIBILITY SameMajorVersion
)
join_paths(libdir_for_pc_file "\${exec_prefix}" "${LSPCPP_LIB_DIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(
"${PROJECT_SOURCE_DIR}/support/cmake/lspcpp.pc.in"
"${pkgconfig}"
@ONLY)
install(TARGETS network-uri
EXPORT NetworkURITargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT NetworkURITargets
FILE NetworkURITargets.cmake
DESTINATION lib/cmake/NetworkURI)
install(DIRECTORY ${LSPCPP_INCLUDE_DIR}/LibLsp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
USE_SOURCE_PERMISSIONS
)
install(TARGETS lspcpp
EXPORT ${targets_export_name}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT ${targets_export_name}
NAMESPACE lspcpp::
DESTINATION ${LSPCPP_CMAKE_DIR}
)
install(
FILES ${project_config} ${version_config}
DESTINATION ${LSPCPP_CMAKE_DIR}
)
install(FILES "${pkgconfig}" DESTINATION "${LSPCPP_PKGCONFIG_DIR}")
endif()
# examples
if(LSPCPP_BUILD_EXAMPLES)
###########################################################
# OS libraries
###########################################################
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LSPCPP_OS_LIBS WS2_32)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LSPCPP_OS_LIBS pthread)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(LSPCPP_OS_LIBS)
endif()
function(build_example target)
add_executable(${target} "${CMAKE_CURRENT_SOURCE_DIR}/examples/${target}.cpp")
target_include_directories(${target} PRIVATE ${LSP_INCLUDE_LIST})
set_target_properties(${target} PROPERTIES
FOLDER "Examples"
)
lspcpp_set_target_options(${target})
target_link_libraries(${target} PRIVATE lspcpp "${LSPCPP_OS_LIBS}")
endfunction(build_example)
set(EXAMPLES
StdIOClientExample
StdIOServerExample
TcpServerExample
WebsocketExample
)
foreach (example ${EXAMPLES})
build_example(${example})
endforeach()
endif()
# Add a distclean target to the Makefile
ADD_CUSTOM_TARGET(distclean COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/support/cmake/distclean.cmake)