-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
526 lines (472 loc) · 20.8 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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
cmake_minimum_required(VERSION 3.0)
project(NewsflashPlus)
message(STATUS "
~~ Newsflash Plus ~~
World's best newsreader!
\\\\o Brought to you by Ensisoft o//
http://www.ensisoft.com
Copyright (c) 2010-2017 Sami Väisänen
Ensisoft
https://github.com/ensisoft/newsflash-plus
")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
message("
This is the Debug build (by default)
For Release build use the following:
cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release
")
endif(NOT CMAKE_BUILD_TYPE)
# Unfortunately we need boost...
set(Boost_USE_STATIC_LIBS ON)
if(WIN32)
set(BOOST_ROOT $ENV{BOOST_ROOT})
if (NOT BOOST_ROOT)
set(BOOST_ROOT "c:/local/boost_1_72_0")
message("
Bollocks. BOOST_ROOT was not set. Defaulting to ${BOOST_ROOT}
TL;DR BOOST_ROOT is a variable that points to your Boost installation
root. So for example if your Boost is installed in C:/boost_1_72_0
your BOOST_ROOT should be c:/boost_1_72_0.
You can set the variable in M$ command prompt with
$ set BOOST_ROOT=c:/boost_1_72_0
and in Linux in your terminal (in bash)
$ export BOOST_ROOT=/usr/local/boost_1_72_0
")
endif()
endif()
# for some reason the find_package fails on windows when we say which
# libs we'd like to use. Anyway the linking is automatic so we'll just
# add the libs manually to linking options for Linux.
#find_package(Boost REQUIRED COMPONENTS system filesystem)
find_package(Boost REQUIRED COMPONENTS filesystem thread regex system)
if(NOT Boost_FOUND)
if (UNIX)
message(FATAL_ERROR "
Boost (http://www.boost.org) development libraries were not found.
You should be able to use the boost dev packages available in your distro's repos.
On Ubuntu you might want to try 'sudo apt-get install libboost-all-dev'
On other distros please consult your distro's docs on how to install Boost.
I'm going to crap out now. >.<
")
elseif(WIN32)
message(FATAL_ERROR "
Boost (http://www.boost.org) development libraries were not found.
You can download a prebuilt binary package from http://www.boost.org.
Or if you're using Visual Studio 2015 you can follow this direct link:
https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
If you have boost but not in a default location or another version of boost
you can try to specify BOOST_ROOT environment variable.
I'm going to crap out now. >.<
")
endif()
endif()
# why is this not set!?
# should come from cmake through find_package(Boost, ...)
if(NOT Boost_LIBRARY_DIRS)
message(WARNING "
Boost_LIBRARY_DIRS is not set.
I'm going to use a default for MSVS 14 2015 Win64.
If that doesn't match your build environment/compiler/arch you will need
to edit the line below this message manually.
Sorry about that :-(
")
set(Boost_LIBRARY_DIRS "${BOOST_ROOT}/lib64-msvc-14.0")
endif()
message(STATUS "${Boost_INCLUDE_DIRS}")
message(STATUS "${Boost_LIBRARY_DIRS}")
# see this bug report about C++14 and Qt
# https://bugreports.qt.io/browse/QTBUG-53002
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
# /wd4251 Qt dll interface crap
# /wd4275 Qt dll interface crap again
# /wd4018 signed/unsigned mismatch
# /wd4244 conversion from double to float
# /wd4305 truncation from double to float
# /wd4267 conversion from size_t to int (Qt uses ints extensively)
add_definitions("/wd4251 /wd4275 /wd4018 /wd4244 /wd4305 /wd4267")
endif()
# expected location on win to find Qt
if (WIN32)
set(CMAKE_PREFIX_PATH "C:/Qt/5.12.6/msvc2017_64")
endif()
find_package(Qt5Widgets)
find_package(Qt5Network)
find_package(Qt5Xml)
if (WIN32)
find_package(Qt5AxContainer)
endif()
if (NOT Qt5Widgets_FOUND)
message("
Qt5 was not found.
")
else()
message(STATUS "Qt5 version: ${Qt5Widgets_VERSION}")
message(STATUS "${Qt5Widgets_INCLUDE_DIRS}")
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# generic include directories (same for each platform)
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/openssl/sdk/include")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/zlib")
include_directories(BEFORE "${Boost_INCLUDE_DIRS}")
# UI generated files do a global include for custom widgets such as the pieview.
# so we need to add the gui folder to the include list.
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/gui")
# this tells cmake to include our *current* directory which is our build directory
# in which the Qt tools (moc and uic) will spit out their generated files.
# so for example when you have "include ui_foobar.h" in your code the
# ui_foobar.h is generated by UIC and will be placed in the current dir.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# platform specific include dirs
if (WIN32)
elseif(UNIX)
endif()
# generic link directories (same for each platform)
link_directories("${CMAKE_CURRENT_LIST_DIR}/third_party/openssl/sdk/lib")
link_directories("${CMAKE_CURRENT_LIST_DIR}/third_party/boost_1_51_0/sdk/lib")
# platform specific link dirs
if (WIN32)
link_directories("${CMAKE_CURRENT_LIST_DIR}/third_party/zlib/Release")
elseif(UNIX)
link_directories("${CMAKE_CURRENT_LIST_DIR}/third_party/zlib/")
endif()
if (WIN32)
set(LIB_OPENSSL "ssleay32")
set(LIB_CRYPTO "libeay32")
set(LIB_Z "zlib") # note that in a very gay fashion the lib is zlib.lib and the library is zlib1.dll
elseif(UNIX)
set(LIB_OPENSSL "ssl.a")
set(LIB_CRYPTO "crypto.a")
set(LIB_Z "z")
endif()
# compiler specific compiler & linker flags
if (CMAKE_COMPILER_IS_GNUCC)
# we need -rdynamic for backtrace and backtrace_symbols
# in order to dump a stacktrace from the ASSERT macro.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic -pthread -ldl")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic -pthread -ldl")
set(CMAKE_CXX_STANDARD 14)
elseif(MSVC)
# /Zc:wchar_t treats wchar_t as a native type
# /Zc:wchar_t- treats wchar_t as a typedef for unsigned short.
# Qt requires wchar_t- otherwise the types don't match.
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
if (CMAKE_BUILD_TYPE MATCHES "Release")
# /Zi turns on the .pdb generation. We want this for the release build
# so that we can do post-mortem debugging with the minidump (from the crash)
# and the pdb file.
# /FS is needed for parallel build. It forces data to be written
# through a serialized surrogate process.
# NOTE that the /Zi names the .pdb file as vcx0.pdb where the x is
# the version number. So for example vc120.pdb
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS")
# http://www.wintellect.com/devcenter/jrobbins/correctly-creating-native-c-release-build-pdbs
# need to tell the linker also about the debug data.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF")
endif()
# if this is not defined linking problems will happen on msvc
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
# build the smtpclient library
# it's in third_party but doesn't have a build file so we build it here.
# note that it's LGPL'ed so it needs to be a shared library.
file(GLOB SMTPCLIENT_SOURCE third_party/smtpclient/*.cpp)
add_library(smtpclient SHARED ${SMTPCLIENT_SOURCE})
target_link_libraries(smtpclient
Qt5::Widgets
Qt5::Network)
target_compile_definitions(smtpclient PRIVATE SMTP_BUILD)
add_executable(smtpclient_test third_party/smtpclient/example/main.cpp)
target_link_libraries(smtpclient_test smtpclient Qt5::Core Qt5::Widgets)
# We have a problem with libssl being a conflicting dependency between
# our engine and Qt5. Qt5 uses libssl 1.1.x and we're still on libssl 1.0.x.
# These are not binary compatible.
# Having all the symbols available in the engine library will lead to problems
# when these two libraries are loaded in the process.
# In order to workout this problem we take the socket code and build it into
# a library and tell the linker to hide all symbols *except* for
# MakeNewsflashSocket which is public. Then the rest of the engine code
# simply uses this API to create a socket and libssl stays hidden.
# Extern C is just to simplify specificing the symbol name (no mangling)
# in the linker file
add_library(socketlib SHARED
engine/socket.cpp
engine/socketapi.cpp
engine/tcpsocket.cpp
engine/sslsocket.cpp
engine/sslcontext.cpp
engine/assert.cpp
engine/waithandle.cpp
engine/platform.cpp
)
target_link_libraries(socketlib PRIVATE
${LIB_OPENSSL}
${LIB_CRYPTO})
if (CMAKE_COMPILER_IS_GNUCC)
target_link_options(socketlib PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/engine/linux_linker_openssl_war.version")
endif()
target_compile_definitions(socketlib PRIVATE NEWSFLASH_BUILD_SOCKET_LIB)
# build the engine lib
add_library(engine STATIC
engine/assert.cpp
engine/bigfile.cpp
engine/connection.cpp
engine/decode.cpp
engine/download.cpp
engine/encoding.cpp
engine/engine.cpp
engine/event.cpp
engine/filebuf.cpp
engine/filemap.cpp
engine/filesys.cpp
engine/filetype.cpp
engine/format.cpp
engine/iso_8859_15.cpp
engine/listing.cpp
engine/logging.cpp
engine/minidump.cpp
engine/nntp.cpp
engine/platform.cpp
engine/session.cpp
engine/threadpool.cpp
engine/update.cpp
engine/waithandle.cpp
engine/socketapi.cpp
third_party/base64/base64.cpp)
target_link_libraries(engine PUBLIC
socketlib
${Boost_LIBRARIES}
${LIB_Z})
file(GLOB APP_SOURCE app/*.h app/*.cpp)
file(GLOB GUI_SOURCE gui/*.h gui/*.cpp gui/*.ui)
add_library(appcore STATIC
${APP_SOURCE}
tools/keygen/keygen.cpp
stringlib/string.cpp)
target_link_libraries(appcore PUBLIC
engine
smtpclient
Qt5::Core
Qt5::Widgets
Qt5::Xml
Qt5::Network
# just need libregex really
${Boost_LIBRARIES})
if(WIN32)
set(ICO_SOURCE "gui/icon.rc")
endif()
# build the main application
add_executable(newsflash
${GUI_SOURCE}
${ICO_SOURCE}
gui/resource.qrc
gui/qtsingleapplication/qtsingleapplication.h
gui/qtsingleapplication/qtsingleapplication.cpp
gui/qtsingleapplication/qtlocalpeer.h
gui/qtsingleapplication/qtlocalpeer.cpp)
if (MSVC)
# https://msdn.microsoft.com/en-us/library/fcc1zstk.aspx
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
#
# this option is needed starting with msvc2012(?) to allow the binary run on WinXP.
# NOTE: that it seems to be enough to have this on the executable, so theres
# no need to dick around with Qt, json, zlib settings.
#
# WINDOWS, creates a win32 application that uses WinMain, no console.
# CONSOLE, creates a console application that uses main(), system created console.
# 5.2 = Win XP 64bit version
if (CMAKE_BUILD_TYPE MATCHES "Release")
set_target_properties(newsflash PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS,5.2")
target_link_libraries(newsflash Qt5::WinMain)
elseif(CMAKE_BUILD_TYPE MATCHES "Debug")
set_target_properties(newsflash PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE,5.2")
endif()
target_link_libraries(newsflash appcore Qt5::AxContainer)
else()
target_link_libraries(newsflash appcore)
endif()
# build the keygen
#
# add_executable(keygen
# tools/keygen/main.cpp
# tools/keygen/keygen.cpp
# app/webengine.h
# app/webengine.cpp
# app/webquery.h
# app/webquery.cpp
# app/debug.h
# app/debug.cpp
# engine/assert.cpp)
# target_link_libraries(keygen
# Qt5::Core
# Qt5::Network)
# build the join tool for joining .001, .002 ... files
add_executable(join tools/joiner/main.cpp)
target_link_libraries(join Qt5::Core)
# this is a dummy test server used by some of the test cases.
# it must be built and running before tests can be run.
add_executable(test_server engine/unit_test/server.cpp)
target_link_libraries(test_server engine)
# build unit test.
enable_testing()
add_executable(unit_test_utf8 engine/unit_test/unit_test_utf8.cpp)
add_executable(unit_test_uuencode engine/unit_test/unit_test_uuencode.cpp)
add_executable(unit_test_yenc engine/unit_test/unit_test_yenc.cpp)
add_executable(unit_test_session engine/unit_test/unit_test_session.cpp)
add_executable(unit_test_buffer engine/unit_test/unit_test_buffer.cpp)
add_executable(unit_test_threadpool engine/unit_test/unit_test_threadpool.cpp)
add_executable(unit_test_event engine/unit_test/unit_test_event.cpp)
add_executable(unit_test_tcpsocket
engine/unit_test/unit_test_tcpsocket.cpp
engine/assert.cpp
engine/platform.cpp
engine/socketapi.cpp
engine/tcpsocket.cpp
engine/waithandle.cpp)
add_executable(unit_test_sslsocket engine/unit_test/unit_test_sslsocket.cpp
engine/assert.cpp
engine/platform.cpp
engine/socketapi.cpp
engine/sslsocket.cpp
engine/sslcontext.cpp
engine/waithandle.cpp)
add_executable(unit_test_listing engine/unit_test/unit_test_listing.cpp)
add_executable(unit_test_download engine/unit_test/unit_test_download.cpp)
add_executable(unit_test_update engine/unit_test/unit_test_update.cpp)
add_executable(unit_test_stringtable engine/unit_test/unit_test_stringtable.cpp
engine/stringtable.cpp)
add_executable(unit_test_datafile engine/unit_test/unit_test_datafile.cpp)
add_executable(unit_test_catalog engine/unit_test/unit_test_catalog.cpp)
add_executable(unit_test_index engine/unit_test/unit_test_index.cpp)
add_executable(unit_test_cmdlist engine/unit_test/unit_test_cmdlist.cpp)
add_executable(unit_test_nntp engine/unit_test/unit_test_nntp.cpp)
add_executable(unit_test_linebuffer engine/unit_test/unit_test_linebuffer.cpp)
add_executable(unit_test_bigfile engine/unit_test/unit_test_bigfile.cpp)
add_executable(unit_test_filemap engine/unit_test/unit_test_filemap.cpp)
add_executable(unit_test_filebuf engine/unit_test/unit_test_filebuf.cpp)
add_executable(unit_test_bodyiter engine/unit_test/unit_test_bodyiter.cpp)
add_executable(unit_test_decode engine/unit_test/unit_test_decode.cpp)
add_executable(unit_test_filetype engine/unit_test/unit_test_filetype.cpp)
add_executable(unit_test_throttle engine/unit_test/unit_test_throttle.cpp)
add_executable(unit_test_engine engine/unit_test/unit_test_engine.cpp)
add_executable(unit_test_connection engine/unit_test/unit_test_connection.cpp)
target_link_libraries(unit_test_utf8 engine)
target_link_libraries(unit_test_uuencode engine)
target_link_libraries(unit_test_yenc engine)
target_link_libraries(unit_test_session engine)
target_link_libraries(unit_test_buffer engine)
target_link_libraries(unit_test_threadpool engine)
target_link_libraries(unit_test_event engine)
target_link_libraries(unit_test_tcpsocket engine)
target_link_libraries(unit_test_sslsocket engine ${LIB_OPENSSL} ${LIB_CRYPTO})
target_link_libraries(unit_test_listing engine)
target_link_libraries(unit_test_download engine)
target_link_libraries(unit_test_update engine)
target_link_libraries(unit_test_stringtable engine)
target_link_libraries(unit_test_datafile engine)
target_link_libraries(unit_test_catalog engine)
target_link_libraries(unit_test_index engine)
target_link_libraries(unit_test_cmdlist engine)
target_link_libraries(unit_test_nntp engine)
target_link_libraries(unit_test_linebuffer engine)
target_link_libraries(unit_test_bigfile engine)
target_link_libraries(unit_test_filemap engine)
target_link_libraries(unit_test_filebuf engine)
target_link_libraries(unit_test_bodyiter engine)
target_link_libraries(unit_test_decode engine)
target_link_libraries(unit_test_filetype engine)
target_link_libraries(unit_test_throttle engine)
target_link_libraries(unit_test_engine engine)
target_link_libraries(unit_test_connection engine)
add_test(NAME unit_test_utf8 COMMAND unit_test_utf8)
add_test(NAME unit_test_uuencode COMMAND unit_test_uuencode)
add_test(NAME unit_test_yenc COMMAND unit_test_yenc)
add_test(NAME unit_test_session COMMAND unit_test_session)
add_test(NAME unit_test_buffer COMMAND unit_test_buffer)
add_test(NAME unit_test_threadpool COMMAND unit_test_threadpool)
add_test(NAME unit_test_event COMMAND unit_test_event)
add_test(NAME unit_test_tcpsocket COMMAND unit_test_tcpsocket)
add_test(NAME unit_test_sslsocket COMMAND unit_test_sslsocket)
add_test(NAME unit_test_listing COMMAND unit_test_listing)
add_test(NAME unit_test_download COMMAND unit_test_download)
add_test(NAME unit_test_update COMMAND unit_test_update)
add_test(NAME unit_test_stringtable COMMAND unit_test_stringtable)
add_test(NAME unit_test_datafile COMMAND unit_test_datafile)
add_test(NAME unit_test_catalog COMMAND unit_test_catalog)
add_test(NAME unit_test_index COMMAND unit_test_index)
add_test(NAME unit_test_cmdlist COMMAND unit_test_cmdlist)
add_test(NAME unit_test_nntp COMMAND unit_test_nntp)
add_test(NAME unit_test_linebuffer COMMAND unit_test_linebuffer)
add_test(NAME unit_test_bigfile COMMAND unit_test_bigfile)
add_test(NAME unit_test_filemap COMMAND unit_test_filemap)
add_test(NAME unit_test_filebuf COMMAND unit_test_filebuf)
add_test(NAME unit_test_bodyiter COMMAND unit_test_bodyiter)
add_test(NAME unit_test_decode COMMAND unit_test_decode)
add_test(NAME unit_test_filetype COMMAND unit_test_filetype)
add_test(NAME unit_test_throttle COMMAND unit_test_throttle)
add_test(NAME unit_test_engine COMMAND unit_test_engine)
add_test(NAME unit_test_connection COMMAND unit_test_connection)
# this test case fails on msvs with stack overflow
# set the stack size to 4mb
if (MSVC)
set_target_properties(unit_test_update PROPERTIES LINK_FLAGS "/STACK:4194304")
endif()
add_executable(unit_test_accounts app/unit_test/unit_test_accounts.cpp)
add_executable(unit_test_debug app/unit_test/unit_test_debug.cpp)
add_executable(unit_test_media app/unit_test/unit_test_media.cpp)
add_executable(unit_test_nzbparse app/unit_test/unit_test_nzbparse.cpp)
add_executable(unit_test_parstate app/unit_test/unit_test_parstate.cpp)
add_executable(unit_test_poweroff app/unit_test/unit_test_poweroff.cpp)
add_executable(unit_test_rss_date app/unit_test/unit_test_rss_date.cpp)
add_executable(unit_test_settings app/unit_test/unit_test_settings.cpp)
add_executable(unit_test_unrar app/unit_test/unit_test_unrar.cpp)
add_executable(unit_test_unzip app/unit_test/unit_test_unzip.cpp)
add_executable(unit_test_webengine app/unit_test/unit_test_webengine.cpp)
target_link_libraries(unit_test_accounts appcore)
target_link_libraries(unit_test_debug appcore)
target_link_libraries(unit_test_media appcore)
target_link_libraries(unit_test_nzbparse appcore)
target_link_libraries(unit_test_parstate appcore)
target_link_libraries(unit_test_poweroff appcore)
target_link_libraries(unit_test_rss_date appcore)
target_link_libraries(unit_test_settings appcore)
target_link_libraries(unit_test_unrar appcore)
target_link_libraries(unit_test_unzip appcore)
target_link_libraries(unit_test_webengine appcore)
add_test(NAME unit_test_accounts COMMAND unit_test_accounts)
add_test(NAME unit_test_debug COMMAND unit_test_debug)
add_test(NAME unit_test_media COMMAND unit_test_media)
add_test(NAME unit_test_nzbparse COMMAND unit_test_nzbparse)
add_test(NAME unit_test_parstate COMMAND unit_test_parstate)
add_test(NAME unit_test_poweroff COMMAND unit_test_poweroff)
add_test(NAME unit_test_rss_date COMMAND unit_test_rss_date)
add_test(NAME unit_test_settings COMMAND unit_test_settings)
add_test(NAME unit_test_unrar COMMAND unit_test_unrar)
add_test(NAME unit_test_unzip COMMAND unit_test_unzip)
add_test(NAME unit_test_webengine COMMAND unit_test_webengine)
file(GLOB LICENSE_FILES doc/*.txt)
if (CMAKE_BUILD_TYPE MATCHES "Release")
install(TARGETS newsflash join smtpclient socketlib DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist")
file(COPY ${LICENSE_FILES}
DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist")
if (UNIX)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/newsflash.sh" DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist")
endif()
elseif(CMAKE_BUILD_TYPE MATCHES "Debug")
install(TARGETS newsflash join smtpclient socketlib DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist_d")
file(COPY ${LICENSE_FILES}
DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist_d")
if (UNIX)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/newsflash.sh" DESTINATION "${CMAKE_CURRENT_LIST_DIR}/dist_d")
endif()
endif()