forked from gammu/gammu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
966 lines (815 loc) · 36.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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
# cmake <https://cmake.org/> build file for Gammu
# Copyright (c) 2007 - 2017 Michal Cihar
# vim: expandtab sw=4 ts=4 sts=4:
cmake_minimum_required (VERSION 3.0)
INCLUDE (CMakeForceCompiler)
project (Gammu C)
# Where to lookup modules
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Silent some warnings from CMake 2.6
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0009 NEW)
option (COVERAGE "Add flags for Coverage analysis" OFF)
option (ONLINE_TESTING "Enable testing of parts which use remote servers" OFF)
option (PSQL_TESTING "Enable testing of PostgreSQL SMSD backend" OFF)
option (MYSQL_TESTING "Enable testing of MySQL SMSD backend" OFF)
option (ODBC_TESTING "Enable testing of ODBC MySQL SMSD backend" OFF)
option (BUILD_SHARED_LIBS "Build shared libraries" ON)
option (LARGE_FILES "Support for large files" ON)
if (LARGE_FILES)
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
endif (LARGE_FILES)
# Set version
set (GAMMU_VERSION "1.38.2" CACHE INTERNAL "")
string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\1" "GAMMU_VERSION_MAJOR" "${GAMMU_VERSION}")
string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\2" "GAMMU_VERSION_MINOR" "${GAMMU_VERSION}")
string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\3" "GAMMU_VERSION_PATCH" "${GAMMU_VERSION}")
math(EXPR GAMMU_VERSION_NUM "${GAMMU_VERSION_MAJOR} * 10000 + ${GAMMU_VERSION_MINOR} * 100 + ${GAMMU_VERSION_PATCH}")
message (STATUS "Configuring ${CMAKE_PROJECT_NAME} ${GAMMU_VERSION}")
set (GAMMU_SOVERSION "8" CACHE INTERNAL "")
if ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
message ("Warning: In tree build is not recommended way to build Gammu.")
endif ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
# For debugging
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# set (CMAKE_VERBOSE_MAKEFILE ON)
set (DEBUG 1)
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (DEBUG 0)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
# Standard packages
include (CheckCSourceCompiles)
include (CheckCCompilerFlag)
include (CheckIncludeFile)
include (CheckIncludeFiles)
include (CheckFunctionExists)
include (CheckSymbolExists)
include (CheckTypeSize)
include (CheckLibraryExists)
include (FindPkgConfig)
# Packages in our sources (mostly taken from KDE)
include (MacroOptionalFindPackage)
include (MacroAddDLL)
include (MacroGammuOption)
include (MacroTuneCompiler)
# WE use pkgconfig later
find_package (PkgConfig)
# enable code coverage
find_package(codecov)
# Standard packages
macro_optional_find_package (Doxygen)
# I'd say this is task of CMake to export this
check_symbol_exists (__clang__ "" CLANG_COMPILER)
# Configuration checks
check_symbol_exists (strncasecmp "string.h" HAVE_STRNCASECMP)
check_symbol_exists (strcasecmp "string.h" HAVE_STRCASECMP)
check_symbol_exists (_strnicmp "string.h" HAVE_STRNICMP)
check_symbol_exists (_stricmp "string.h" HAVE_STRICMP)
check_function_exists (strcasestr HAVE_STRCASESTR)
check_function_exists (strchrnul HAVE_STRCHRNUL)
check_function_exists (strtoull HAVE_STRTOULL)
check_include_file (dirent.h HAVE_DIRENT_H)
check_include_file (sys/ioctl.h HAVE_SYS_IOCTL_H)
check_include_file (sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_file (unistd.h HAVE_UNISTD_H)
check_include_file (wchar.h HAVE_WCHAR_H)
if (HAVE_WCHAR_H)
check_include_files ("wchar.h;wctype.h" HAVE_WCTYPE_H)
check_symbol_exists (iswspace "wchar.h;wctype.h" HAVE_ISWSPACE)
check_symbol_exists (towlower "wchar.h;wctype.h" HAVE_TOWLOWER)
else (HAVE_WCHAR_H)
check_include_file (wctype.h HAVE_WCTYPE_H)
check_symbol_exists (iswspace "wctype.h" HAVE_ISWSPACE)
check_symbol_exists (towlower "wctype.h" HAVE_TOWLOWER)
endif (HAVE_WCHAR_H)
check_symbol_exists (I_SETSIG "stropts.h" HAVE_I_SETSIG)
check_include_file (strings.h HAVE_STRINGS_H)
check_function_exists (scandir HAVE_SCANDIR)
check_function_exists (alphasort HAVE_ALPHASORT)
set (ENABLE_GETOPT ON CACHE BOOL "Enable getopt usage")
set (USE_WCHAR_T ON CACHE BOOL "Use native wchar_t type")
if (ENABLE_GETOPT)
check_symbol_exists (getopt "unistd.h" HAVE_GETOPT)
check_symbol_exists (getopt_long "getopt.h" HAVE_GETOPT_LONG)
endif (ENABLE_GETOPT)
check_symbol_exists (daemon "unistd.h" HAVE_DAEMON_UNISTD)
check_symbol_exists (daemon "stdlib.h" HAVE_DAEMON_STDLIB)
check_symbol_exists (kill "signal.h" HAVE_KILL)
check_symbol_exists (sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
check_symbol_exists (getpwnam "pwd.h" HAVE_GETPWNAM)
check_symbol_exists (getgrnam "grp.h" HAVE_GETGRNAM)
check_symbol_exists (getpwuid "pwd.h" HAVE_GETPWUID)
check_symbol_exists (getuid "unistd.h" HAVE_GETUID)
check_symbol_exists (initgroups "grp.h" HAVE_INITGROUPS)
check_symbol_exists (setuid "unistd.h" HAVE_SETUID)
check_symbol_exists (setgid "unistd.h" HAVE_SETGID)
check_symbol_exists (SIGHUP "signal.h" HAVE_SIGHUP)
check_symbol_exists (SIGUSR1 "signal.h" HAVE_SIGUSR1)
check_symbol_exists (SIGUSR2 "signal.h" HAVE_SIGUSR2)
check_symbol_exists (dup "unistd.h" HAVE_DUP_UNISTD_H)
check_symbol_exists (getpid "unistd.h" HAVE_GETPID)
check_symbol_exists (getpass "unistd.h" HAVE_GETPASS)
check_symbol_exists (alarm "unistd.h" HAVE_ALARM)
check_symbol_exists (dup "io.h" HAVE_DUP_IO_H)
check_symbol_exists (shmget "sys/shm.h" HAVE_SHM)
check_c_source_compiles ("
#define _XOPEN_SOURCE
#define _BSD_SOURCE
#include <time.h>
int main(void) {
struct tm timestruct;
strptime(\"11:22\", \"%H:%M\", ×truct);
return 0;
}" HAVE_STRPTIME)
check_c_source_compiles ("
#include <stdio.h>
#include <syslog.h>
#include <stdarg.h>
int main(void) {
syslog(LOG_NOTICE, \"aaa %d\", 1);
return 0;
}
" HAVE_SYSLOG)
# Some compilers (eg. BCC) have this in ctype.h
if (NOT HAVE_TOWLOWER)
check_symbol_exists (towlower "ctype.h" HAVE_TOWLOWER_CTYPE)
if (HAVE_TOWLOWER_CTYPE)
set (HAVE_TOWLOWER ${HAVE_TOWLOWER_CTYPE} CACHE INTERNAL "")
endif (HAVE_TOWLOWER_CTYPE)
endif (NOT HAVE_TOWLOWER)
# Standard packages
macro_optional_find_package (Threads)
# Used (optionally for testing)
find_program(SH_BIN sh)
find_program(BASH_BIN bash)
find_program(SQLITE_BIN sqlite3)
find_program(SED_BIN sed)
if (WIN32)
find_program(MYSQL_BIN mysql $ENV{ProgramFiles}/MySQL/*/bin $ENV{SystemDrive}/MySQL/*/bin "c:/Program Files/MySQL/*/bin")
find_program(PSQL_BIN psql $ENV{ProgramFiles}/PostgreSQL/*/bin $ENV{SystemDrive}/PostgreSQL/*/bin "c:/Program Files/PostgreSQL/*/bin")
else()
find_program(MYSQL_BIN mysql)
find_program(PSQL_BIN psql)
endif()
find_package (Threads)
# Check for Python
find_package(PythonInterp 2)
# Packages in sources
macro_optional_find_package (MySQL)
macro_optional_find_package (ODBC)
macro_optional_find_package (Postgres)
macro_optional_find_package (LibDBI)
macro_optional_find_package (Libintl)
macro_optional_find_package (Iconv)
macro_optional_find_package (CURL)
macro_optional_find_package (Glib)
macro_optional_find_package (GObject)
macro_optional_find_package (SystemD)
# Gudev stuff
pkg_check_modules(GUDEV gudev-1.0)
if (CMAKE_CROSSCOMPILING AND MINGW)
set (HAVE_WINT_T True CACHE INTERNAL "")
set (HAVE_WCHAR_T True CACHE INTERNAL "")
else (CMAKE_CROSSCOMPILING AND MINGW)
# Search for needed includes and functions
if (HAVE_WCHAR_H)
set (CMAKE_EXTRA_INCLUDE_FILES wchar.h)
check_type_size (wchar_t WCHAR_T)
check_type_size (wint_t WINT_T)
endif (HAVE_WCHAR_H)
set (CMAKE_EXTRA_INCLUDE_FILES)
endif (CMAKE_CROSSCOMPILING AND MINGW)
set (CMAKE_EXTRA_INCLUDE_FILES stdio.h)
check_type_size (ssize_t SSIZE_T)
set (CMAKE_EXTRA_INCLUDE_FILES)
if (HAVE_UNISTD_H)
set (CMAKE_EXTRA_INCLUDE_FILES unistd.h)
check_type_size(intptr_t INTPTR_T)
set (CMAKE_EXTRA_INCLUDE_FILES)
else(HAVE_UNISTD_H)
check_type_size(intptr_t INTPTR_T)
endif (HAVE_UNISTD_H)
check_c_source_compiles ("
#include <stdio.h>
int main(void) {
printf( __FUNCTION__);
return 0;
}
" HAVE_MACRO_FUNCTION)
check_c_source_compiles ("
#include <time.h>
int main(void) {
struct tm tm;
tm.tm_zone;
return 0;
}
" HAVE_STRUCT_TM_TM_ZONE)
check_c_source_compiles ("
#include <time.h>
int main(void) {
struct tm tm;
tm.tm_isdst = daylight;
return 0;
}
" HAVE_DAYLIGHT)
check_c_source_compiles ("
#include <stdio.h>
int main(void) {
printf( __FUNC__);
return 0;
}
" HAVE_MACRO_FUNC)
OPTION(WITH_BLUETOOTH "Bluetooth support" ON)
if (WITH_BLUETOOTH)
if (WIN32 AND NOT CYGWIN)
# FIXME: This is currently hardcoded here, maybe there is test?
set(BLUETOOTH_FOUND ON)
message(STATUS "Using Windows native Bluetooth")
set(BLUETOOTH_SEARCH TRUE)
elseif(CYGWIN)
message(STATUS "Bluetooth is currently not supported in Cygwin")
message(STATUS "If you need it, contact us")
else (WIN32 AND NOT CYGWIN)
find_package (Bluez)
if (BLUEZ_FOUND)
set(BLUETOOTH_FOUND ON)
set(BLUETOOTH_SEARCH TRUE)
message(STATUS "Using BlueZ stack")
endif (BLUEZ_FOUND)
find_package (BSDBluetooth)
if (BSD_BLUE_FOUND)
set(BLUETOOTH_FOUND ON)
message(STATUS "Using BSD Bluetooth stack")
check_library_exists(bluetooth sdp_service_search_attribute "" HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE)
check_library_exists(bluetooth bt_devinquiry "" HAVE_BT_DEVINQUIRY)
if (HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE AND HAVE_BT_DEVINQUIRY)
set(BLUETOOTH_SEARCH TRUE)
endif (HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE AND HAVE_BT_DEVINQUIRY)
endif (BSD_BLUE_FOUND)
find_package (OSXBluetooth)
if (OSX_BLUE_FOUND)
set(BLUETOOTH_FOUND ON)
set(BLUETOOTH_SEARCH FALSE)
message(STATUS "Using OSX Bluetooth stack")
endif (OSX_BLUE_FOUND)
endif (WIN32 AND NOT CYGWIN)
else (WITH_BLUETOOTH)
set(BLUETOOTH_FOUND FALSE)
set(BLUETOOTH_INCLUDE_DIR)
set(BLUETOOTH_INCLUDES)
set(BLUETOOTH_LIBRARY)
set(BLUETOOTH_LIBRARIES)
endif (WITH_BLUETOOTH)
if (BLUETOOTH_FOUND)
message(STATUS "Bluetooth support enabled")
else (BLUETOOTH_FOUND)
if (WITH_BLUETOOTH AND NOT CYGWIN)
message("Bluetooth support disabled, please install libbluetooth-dev or equivalent to enable Bluetooth.")
endif (WITH_BLUETOOTH AND NOT CYGWIN)
endif (BLUETOOTH_FOUND)
macro_gammu_option (BLUETOOTH_RF_SEARCHING "Searching for RF channels with Bluetooth stack" ON BLUETOOTH_FOUND BLUETOOTH_SEARCH)
if (WITH_BLUETOOTH_RF_SEARCHING)
set (BLUETOOTH_RF_SEARCHING ON)
endif (WITH_BLUETOOTH_RF_SEARCHING)
OPTION(WITH_USB "Native USB support" ON)
if (WITH_USB)
find_package (LibUSB)
endif (WITH_USB)
OPTION(WITH_IRDA "IrDA support" ON)
if (WITH_IRDA)
if (WIN32 AND NOT CYGWIN)
# FIXME: This is currently hardcoded here, maybe there is test?
set (IRDA_FOUND TRUE)
message(STATUS "Using Windows native IrDA")
elseif(CYGWIN)
message(STATUS "IrDA is currently not supported in Cygwin")
message(STATUS "If you need it, contact us")
set (IRDA_FOUND FALSE)
else (WIN32 AND NOT CYGWIN)
check_c_source_compiles (
"
#include <sys/socket.h>
#include <linux/types.h>
#include <sys/ioctl.h>
#include <linux/irda.h>
int main(int argc, char **argv) {
return 0;
}
"
IRDA_FOUND
)
if (IRDA_FOUND)
message(STATUS "Using Linux native IrDA")
endif (IRDA_FOUND)
endif (WIN32 AND NOT CYGWIN)
else (WITH_IRDA)
set (IRDA_FOUND FALSE)
endif (WITH_IRDA)
if (IRDA_FOUND)
message(STATUS "IrDA support enabled")
endif (IRDA_FOUND)
if (MYSQL_FOUND)
set (HAVE_MYSQL_MYSQL_H TRUE)
if (WIN32)
set(WIN_LIB_MYSQL libmysql.dll)
endif ()
endif (MYSQL_FOUND)
if (POSTGRES_FOUND)
set (HAVE_POSTGRESQL_LIBPQ_FE_H TRUE)
if (WIN32)
set(WIN_LIB_PGSQL libpq.dll SSLEAY32.DLL LIBEAY32.DLL LIBINTL-8.DLL)
endif ()
endif (POSTGRES_FOUND)
set (GAMMU_LIBS "")
if (BLUEZ_FOUND)
if (NOT "${BLUEZ_LIBRARIES}" STREQUAL "")
set (GAMMU_LIBS "${GAMMU_LIBS} -l${BLUEZ_LIBRARIES}")
endif (NOT "${BLUEZ_LIBRARIES}" STREQUAL "")
endif (BLUEZ_FOUND)
if (BSD_BLUE_FOUND)
if (NOT "${BSD_BLUE_LIBRARIES}" STREQUAL "")
set (GAMMU_LIBS "${GAMMU_LIBS} -l${BSD_BLUE_LIBRARIES}")
endif (NOT "${BSD_BLUE_LIBRARIES}" STREQUAL "")
endif (BSD_BLUE_FOUND)
if (ICONV_FOUND)
if (NOT "${ICONV_LIBRARIES}" STREQUAL "")
set (GAMMU_LIBS "${GAMMU_LIBS} -l${ICONV_LIBRARIES}")
endif (NOT "${ICONV_LIBRARIES}" STREQUAL "")
endif (ICONV_FOUND)
if (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
set (GAMMU_LIBS "${GAMMU_LIBS} -l${LIBINTL_LIBRARIES}")
endif (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
if (LIBUSB_FOUND)
if (NOT "${LIBUSB_LIBRARIES}" STREQUAL "")
set (GAMMU_LIBS "${GAMMU_LIBS} -l${LIBUSB_LIBRARIES}")
endif (NOT "${LIBUSB_LIBRARIES}" STREQUAL "")
endif (LIBUSB_FOUND)
set (SMSD_LIBS "")
if (MYSQL_FOUND)
if (NOT "${MYSQL_LIBRARIES}" STREQUAL "")
set (SMSD_LIBS "${SMSD_LIBS} -l${MYSQL_LIBRARIES}")
endif (NOT "${MYSQL_LIBRARIES}" STREQUAL "")
endif (MYSQL_FOUND)
if (POSTGRES_FOUND)
if (NOT "${POSTGRES_LIBRARY}" STREQUAL "")
set (SMSD_LIBS "${SMSD_LIBS} -l${POSTGRES_LIBRARY}")
endif (NOT "${POSTGRES_LIBRARY}" STREQUAL "")
endif (POSTGRES_FOUND)
# Tweak compiler flags
if(MSVC)
# MSVC needs different flags at all
MACRO_TUNE_COMPILER("/W3")
# we use old runtime
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
# we use strcpy instead of strcpy_s
add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1)
# we use ansi API for winsock
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS=1)
# The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS=1)
# Generate PDB data even for release build
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
set(MATH_LIBS "")
else(MSVC)
set(MATH_LIBS "-lm")
endif(MSVC)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX OR CLANG_COMPILER)
# Check for extra compiler flags we want to use
if (NOT GAMMU_VERSION_PATCH LESS 90 OR "$ENV{TRAVIS}" STREQUAL "true")
MACRO_TUNE_COMPILER("-Werror")
endif (NOT GAMMU_VERSION_PATCH LESS 90 OR "$ENV{TRAVIS}" STREQUAL "true")
#
# Warnings related flags
#
MACRO_TUNE_COMPILER("-O2")
MACRO_TUNE_COMPILER("-Wall")
MACRO_TUNE_COMPILER("-Werror-implicit-function-declaration")
MACRO_TUNE_COMPILER("-Wno-deprecated-declarations")
MACRO_TUNE_COMPILER("-Wdeclaration-after-statement")
MACRO_TUNE_COMPILER("-Wpointer-arith")
MACRO_TUNE_COMPILER("-Wfloat-equal")
MACRO_TUNE_COMPILER("-Wbad-function-cast")
MACRO_TUNE_COMPILER("-Wmissing-format-attribute")
MACRO_TUNE_COMPILER("-Wmissing-noreturn")
# This should be enabled and only public functions exported, but it is far future
# MACRO_TUNE_COMPILER("-Wmissing-prototypes")
MACRO_TUNE_COMPILER("-Wpointer-arith")
MACRO_TUNE_COMPILER("-Wshadow")
MACRO_TUNE_COMPILER("-Wstrict-prototypes")
MACRO_TUNE_COMPILER("-Wsign-compare")
# We need some typecasting (especially for iconv)
# MACRO_TUNE_COMPILER("-Wcast-qual")
# Does not work well with default cases for enums
MACRO_TUNE_COMPILER("-Wunreachable-code")
MACRO_TUNE_COMPILER("-Wno-error=unreachable-code")
# Just silent this for now, too much code to fix here
MACRO_TUNE_COMPILER("-Wno-pointer-sign")
MACRO_TUNE_COMPILER("-Wwrite-strings")
MACRO_TUNE_COMPILER("-Wredundant-decls")
if (DEBUG)
MACRO_TUNE_COMPILER("-fstrict-aliasing")
endif (DEBUG)
# Check format strings
MACRO_TUNE_COMPILER("-Wshadow")
MACRO_TUNE_COMPILER("-Wformat=2")
MACRO_TUNE_COMPILER("-Wno-format-y2k")
MACRO_TUNE_COMPILER("-Wno-format-nonliteral")
# Win32 implementation of gettext does not allow us to use so strict warnings
if (WIN32 AND NOT CYGWIN)
MACRO_TUNE_COMPILER("-Wno-format-nonliteral")
MACRO_TUNE_COMPILER("-Wno-format-security")
endif (WIN32 AND NOT CYGWIN)
# This is extremely noisy, use only in debug builds
if (DEBUG)
MACRO_TUNE_COMPILER("-Wextra")
if (NOT CLANG_COMPILER)
MACRO_TUNE_COMPILER("-Wunused-but-set-variable")
endif (NOT CLANG_COMPILER)
# Just silent this for now, too much code to fix here
MACRO_TUNE_COMPILER("-Wno-unused-parameter")
# Not sure if this is safe for all architectures
endif (DEBUG)
#
# Security related flags
#
if (NOT CLANG_COMPILER)
set (ENABLE_PROTECTION ON CACHE BOOL "Enable compile time protections (stack, read only code, fortify in libc...)")
endif (NOT CLANG_COMPILER)
if (ENABLE_PROTECTION)
# Need to enable -O to make fortify work
set (CMAKE_C_FLAGS_DEBUG "-g -O")
add_definitions(-D_FORTIFY_SOURCE=2)
# Text address randomisation, disabled for now, seems to cause problems
# MACRO_TUNE_COMPILER("-fPIE")
# MACRO_TUNE_LINKER("-pie")
# These do not work on Windows right now
if (NOT WIN32)
# Stack protector
MACRO_TUNE_COMPILER("-fstack-protector")
# Mark code read only
MACRO_TUNE_LINKER("-Wl,-zrelro")
endif (NOT WIN32)
endif (ENABLE_PROTECTION)
#
# Other flags
#
if (WIN32 AND NOT CYGWIN AND BUILD_SHARED_LIBS)
MACRO_TUNE_LINKER("-Wl,--enable-auto-import")
endif (WIN32 AND NOT CYGWIN AND BUILD_SHARED_LIBS)
MACRO_TUNE_LINKER("-Wl,--as-needed")
if (NOT WIN32)
set (PIC ON CACHE BOOL "Compile PIC code")
if (PIC)
MACRO_TUNE_COMPILER("-fPIC")
endif (PIC)
endif (NOT WIN32)
# Specs for MinGW to change msvcrt
# This is not supported by MinGW and is broken currently
# if (CMAKE_COMPILER_IS_MINGW)
# MACRO_TUNE_COMPILER("-specs=${CMAKE_CURRENT_SOURCE_DIR}/cmake/mingw.spec")
# add_definitions(-D_MSVCRT_VERSION__=0x090)
# endif (CMAKE_COMPILER_IS_MINGW)
endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX OR CLANG_COMPILER)
if(BORLAND)
# Borland
# Suggests parenthesis
MACRO_TUNE_COMPILER("-wprc")
# Do not warn about unused params
MACRO_TUNE_COMPILER("-w-par")
# Warn about unused vars
MACRO_TUNE_COMPILER("-wuse")
endif(BORLAND)
# Define required libraries for gammu library if it is static
if (BUILD_SHARED_LIBS)
set (GAMMU_PRIVATE_LIBS "" CACHE INTERNAL "Private libraries for gammu library")
set (SMSD_PRIVATE_LIBS "" CACHE INTERNAL "Private libraries for gammu smsd library")
else (BUILD_SHARED_LIBS)
string(REGEX REPLACE "-l(/usr)?(/local)?/lib(64)?/lib([^ ]*).so" "-l\\4" G_LIB "${GAMMU_LIBS}")
string(REGEX REPLACE "-l(/usr)?(/local)?/lib(64)?/lib([^ ]*).so" "-l\\4" S_LIB "${SMSD_LIBS}")
set (GAMMU_PRIVATE_LIBS "${G_LIB}" CACHE INTERNAL "Private libraries for gammu library")
set (SMSD_PRIVATE_LIBS "${S_LIB}" CACHE INTERNAL "Private libraries for gammu smsd library")
endif (BUILD_SHARED_LIBS)
set (DOCS
README.rst
ChangeLog
COPYING
)
if (CMAKE_USE_PTHREADS_INIT)
set (HAVE_PTHREAD ON)
endif (CMAKE_USE_PTHREADS_INIT)
if (UNIX)
find_library (MATH_LIBRARIES m)
# Install paths
if ("${MATH_LIBRARIES}" MATCHES "/lib64/")
set (LIB_SUFFIX "64" CACHE STRING "Suffix of library directory (usually 64 or empty)")
else ("${MATH_LIBRARIES}" MATCHES "/lib64/")
set (LIB_SUFFIX "" CACHE STRING "Suffix of library directory (usually 64 or empty)")
endif ("${MATH_LIBRARIES}" MATCHES "/lib64/")
endif (UNIX)
set (INSTALL_BIN_DIR "bin" CACHE STRING "Path for binaries installation")
mark_as_advanced (INSTALL_BIN_DIR)
set (INSTALL_LIB_DIR "lib${LIB_SUFFIX}" CACHE STRING "Path for libraries installation")
mark_as_advanced (INSTALL_LIB_DIR)
set (INSTALL_LIBDATA_DIR "lib${LIB_SUFFIX}" CACHE STRING "Path for libraries data (eg. pkgconfig data) installation")
mark_as_advanced (INSTALL_LIBDATA_DIR)
set (INSTALL_INC_DIR "include/gammu" CACHE STRING "Path for includes installation")
mark_as_advanced (INSTALL_INC_DIR)
set (INSTALL_LOC_DIR "share/locale" CACHE STRING "Path for locales installation")
mark_as_advanced (INSTALL_LOC_DIR)
set (INSTALL_DATA_DIR "share/gammu" CACHE STRING "Path for data installation")
mark_as_advanced (INSTALL_DATA_DIR)
set (INSTALL_DOC_DIR "share/doc/gammu" CACHE STRING "Path for documentation installation")
mark_as_advanced (INSTALL_DOC_DIR)
set (INSTALL_MAN_DIR "share/man" CACHE STRING "Path for man pages installation")
mark_as_advanced (INSTALL_MAN_DIR)
# Phone and protocol configuration
# Nokia phones
macro_gammu_option (NOKIA_SUPPORT "Nokia support" ON ON ON)
macro_gammu_option (MBUS2 "Nokia MBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (FBUS2 "Nokia FBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (FBUS2DLR3 "Nokia FBUS2DLR3 protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (DKU2PHONET "Nokia DKU2PHONET protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (DKU2AT "Nokia DKU2AT protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (DKU5FBUS2 "Nokia DKU5FBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (FBUS2PL2303 "Nokia FBUS2PL2303 protocol" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (FBUS2BLUE "Nokia FBUS2BLUE protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (PHONETBLUE "Nokia PHONETBLUE protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (BLUEFBUS2 "Nokia BLUEFBUS2 protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (BLUEPHONET "Nokia BLUEPHONET protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (IRDAPHONET "Nokia IRDAPHONET protocol" ON WITH_NOKIA_SUPPORT IRDA_FOUND)
macro_gammu_option (FBUS2IRDA "Nokia FBUS2IRDA protocol" ON WITH_NOKIA_SUPPORT IRDA_FOUND)
macro_gammu_option (NOKIA3320 "Nokia 3320 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (NOKIA650 "Nokia 650 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (NOKIA6110 "Nokia 61xx and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (NOKIA6510 "Nokia 6510 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (DCT4_CALENDAR_6210 "Force using 6210 frames for calendar for DCT4 phones" OFF WITH_NOKIA_SUPPORT WITH_NOKIA6510)
if (WITH_DCT4_CALENDAR_6210)
set (GSM_FORCE_DCT4_CALENDAR_6210 TRUE)
endif (WITH_DCT4_CALENDAR_6210)
macro_gammu_option (NOKIA7110 "Nokia 7110 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (NOKIA9210 "Nokia 9210 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
if (WITH_NOKIA7110 OR WITH_NOKIA9210)
set (wITH_71_92 ON)
else (WITH_NOKIA7110 OR WITH_NOKIA9210)
set (wITH_71_92)
endif (WITH_NOKIA7110 OR WITH_NOKIA9210)
macro_gammu_option (N71_92INCOMINGINFO "Nokia 62xx/71xx/9xxx incoming call/SMS info" OFF WITH_NOKIA_SUPPORT WITH_71_92)
macro_gammu_option (NOKIA3650 "Nokia 3650 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
# AT phones
macro_gammu_option (AT_SUPPORT "AT support" ON ON ON)
macro_gammu_option (AT "AT protocol" ON WITH_AT_SUPPORT ON)
macro_gammu_option (BLUEAT "AT protocol over Bluetooth" ON WITH_AT_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (IRDAAT "AT protocol over IrDA" ON WITH_AT_SUPPORT IRDA_FOUND)
macro_gammu_option (ATGEN "AT phones support" ON WITH_AT_SUPPORT ON)
macro_gammu_option (ALCATEL_SUPPORT "Alcatel support" ON WITH_AT_SUPPORT ON)
macro_gammu_option (ALCABUS "Alcatel protocol" ON WITH_ALCATEL_SUPPORT ON)
macro_gammu_option (ALCATEL "Alcatel phones support" ON WITH_ALCATEL_SUPPORT ON)
# OBEX phones
macro_gammu_option (OBEX_SUPPORT "OBEX compatible phones support" ON ON ON)
macro_gammu_option (BLUEOBEX "OBEX protocol over Bluetooth" ON WITH_OBEX_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (IRDAOBEX "OBEX protocol over IrDA" ON WITH_OBEX_SUPPORT IRDA_FOUND)
macro_gammu_option (OBEXGEN "Generic OBEX phones support" ON WITH_OBEX_SUPPORT ON)
macro_gammu_option (ATOBEX "AT with OBEX phones support" ON WITH_OBEX_SUPPORT WITH_AT_SUPPORT)
macro_gammu_option (ATOBEX_AUTO_MODE "Automatic switching to OBEX for AT+MODE capable phones" OFF WITH_ATOBEX_SUPPORT ON)
macro_gammu_option (S60_SUPPORT "Symbian phones support (S60)" ON ON ON)
macro_gammu_option (GNAPPLET_SUPPORT "Symbian phones support (gnapplet)" ON WITH_NOKIA_SUPPORT ON)
macro_gammu_option (BLUEGNAPBUS "GNAPBUS protocol over Bluetooth" ON WITH_GNAPPLET_SUPPORT BLUETOOTH_FOUND)
macro_gammu_option (IRDAGNAPBUS "GNAPBUS protocol over IrDA" ON WITH_GNAPPLET_SUPPORT IRDA_FOUND)
macro_gammu_option (GNAPGEN "Gnapplet phones support" ON WITH_GNAPPLET_SUPPORT ON)
macro_gammu_option (S60 "S60 phones support" ON WITH_S60_SUPPORT ON)
# Some generic configurations
macro_gammu_option (CELLBROADCAST "Cell Broadcast messages support" ON ON ON)
macro_gammu_option (BACKUP "Backup/Restore functions" ON ON ON)
# Generate Doxygen file
set (DOXYGEN_INPUT "${CMAKE_CURRENT_BINARY_DIR}/include")
set (DOXYGEN_INTERNAL_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/libgammu")
set (DOXYGEN_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gammu-doc")
set (DOXYGEN_INTERNAL_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gammu-internal-doc")
if ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
set (HAVE_DOT "NO")
set (DOXYGEN_DOT_PATH "")
else ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
set (HAVE_DOT "YES")
# Strip binary name from variable
string (REGEX REPLACE "/dot$" "" DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}")
endif ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Doxyfile.cmake" "${CMAKE_CURRENT_BINARY_DIR}/doxygen/Doxyfile")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Doxyfile-internal.cmake" "${CMAKE_CURRENT_BINARY_DIR}/doxygen/Doxyfile-internal")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/api.desc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/doxygen/api.desc")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/internals.desc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/doxygen/internals.desc")
# Target for generating API documentation
add_custom_target (apidoc ${DOXYGEN_EXECUTABLE} doxygen/Doxyfile
COMMENT "Generating API documentation")
add_custom_target (interndoc ${DOXYGEN_EXECUTABLE} doxygen/Doxyfile-internal
COMMENT "Generating internal documentation")
# CPP check
find_program(CPPCHECK_EXECUTABLE NAMES cppcheck
DOC "cppcheck - code checking tool")
add_custom_target (cppcheck ${CPPCHECK_EXECUTABLE} -a -f -q "${CMAKE_CURRENT_SOURCE_DIR}/gammu" "${CMAKE_CURRENT_SOURCE_DIR}/smsd" "${CMAKE_CURRENT_SOURCE_DIR}/helper" "${CMAKE_CURRENT_SOURCE_DIR}/libgammu" "${CMAKE_CURRENT_SOURCE_DIR}/tests" "${CMAKE_CURRENT_SOURCE_DIR}/docs/manual/examples" "${CMAKE_CURRENT_SOURCE_DIR}/contrib/smscgi"
COMMENT "Checking C code")
# Generate pkgconfig file
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gammu.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cfg/gammu.pc" @ONLY)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gammu-smsd.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cfg/gammu-smsd.pc" @ONLY)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gammu-uninstalled.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/gammu.pc" @ONLY)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gammu-smsd-uninstalled.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/gammu-smsd.pc" @ONLY)
# Install instructions
# Install Windows libraries
if (WIN32 AND NOT CYGWIN)
# MySQL
if (MYSQL_FOUND)
foreach(lib ${WIN_LIB_MYSQL})
ADD_DLL("${lib}" "${MYSQL_LIBRARIES}")
endforeach(lib ${WIN_LIB_MYSQL})
endif (MYSQL_FOUND)
# PostgreSQL and dependencies
if (POSTGRES_FOUND)
foreach(lib ${WIN_LIB_PGSQL})
ADD_DLL("${lib}" "${POSTGRES_LIBRARY}")
endforeach(lib ${WIN_LIB_PGSQL})
endif (POSTGRES_FOUND)
# iconv and dependencies
if (ICONV_FOUND)
foreach(lib ${WIN_LIB_ICONV})
ADD_DLL("${lib}" "${ICONV_LIBRARIES}")
endforeach(lib ${WIN_LIB_ICONV})
endif (ICONV_FOUND)
# Gettext and dependencies
if (LIBINTL_LIB_FOUND)
foreach(lib ${WIN_LIB_INTL})
ADD_DLL("${lib}" "${LIBINTL_LIBRARY}")
endforeach(lib ${WIN_LIB_INTL})
endif (LIBINTL_LIB_FOUND)
# Curl and dependencies
if (CURL_FOUND)
foreach(lib ${WIN_LIB_CURL})
ADD_DLL("${lib}" "${CURL_LIBRARIES}")
endforeach(lib ${WIN_LIB_CURL})
endif (CURL_FOUND)
# Glib and dependencies
if (Glib_FOUND)
foreach(lib ${WIN_LIB_GLIB})
ADD_DLL("${lib}" "${Glib_LIBRARIES}")
endforeach(lib ${WIN_LIB_GLIB})
endif (Glib_FOUND)
install (FILES ${WIN32_INSTALL_DLL}
DESTINATION "${INSTALL_BIN_DIR}"
COMPONENT dlls
)
endif (WIN32 AND NOT CYGWIN)
install (
FILES "${CMAKE_CURRENT_BINARY_DIR}/cfg/gammu.pc" "${CMAKE_CURRENT_BINARY_DIR}/cfg/gammu-smsd.pc"
DESTINATION "${INSTALL_LIBDATA_DIR}/pkgconfig"
COMPONENT "pkgconfig"
)
# We want some tests. Even when cross compiling for Windows tests can be
# done in Wine. This is better than nothing, even though Wine is a bit
# more fault tolerant when linking DLLs.
# Testing and dashboard
include(CTest)
enable_testing()
include(Dart)
# Packaging support
set (CPACK_PACKAGE_NAME "Gammu")
set (CPACK_PACKAGE_VERSION "${GAMMU_VERSION}")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gammu All Mobile Management Utilities ${GAMMU_VERSION}")
if (WIN32)
set (CPACK_PACKAGE_VENDOR "Michal Cihar")
set (CPACK_PACKAGE_CONTACT "Michal Cihar <[email protected]>")
else ()
set (CPACK_PACKAGE_VENDOR "Michal Čihař")
set (CPACK_PACKAGE_CONTACT "Michal Čihař <[email protected]>")
endif ()
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/installer/description.txt")
# On Mac OS, the file needs .txt extension, give it to them
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/README.rst" "${CMAKE_CURRENT_BINARY_DIR}/readme.txt" COPYONLY)
set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/readme.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/installer/license.txt")
set (CPACK_PACKAGE_VERSION_MAJOR "${GAMMU_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${GAMMU_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${GAMMU_VERSION_PATCH}")
set (CPACK_INSTALLER_PROGRAM_DISK_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/installer/addpostflight")
if (WIN32 AND NOT CYGWIN)
set (CPACK_SYSTEM_NAME "Windows" CACHE STRING "Windows package name")
endif (WIN32 AND NOT CYGWIN)
# RPM
set (CPACK_RPM_PACKAGE_LICENSE "GPLv2")
if (EXISTS "/etc/SuSE-release")
set (CPACK_RPM_PACKAGE_GROUP "Hardware/Mobile")
else (EXISTS "/etc/SuSE-release")
set (CPACK_RPM_PACKAGE_GROUP "Applications/Communications")
endif (EXISTS "/etc/SuSE-release")
# Components
set (CPACK_COMPONENTS_ALL gammu library smsd headers utils manpages docs pkgconfig symbian examples manual)
if (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
list (APPEND CPACK_COMPONENTS_ALL dlls)
endif (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
set (CPACK_COMPONENT_GAMMU_DISPLAY_NAME "Gammu Application")
set (CPACK_COMPONENT_SMSD_DISPLAY_NAME "Gammu SMS Daemon")
set (CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Gammu Library")
set (CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C Headers")
set (CPACK_COMPONENT_UTILS_DISPLAY_NAME "Utility Scripts")
set (CPACK_COMPONENT_MANPAGES_DISPLAY_NAME "Manual Pages")
set (CPACK_COMPONENT_DOCS_DISPLAY_NAME "User Documentation")
set (CPACK_COMPONENT_PKGCONFIG_DISPLAY_NAME "Pkg-config Data")
set (CPACK_COMPONENT_SYMBIAN_DISPLAY_NAME "Applet for Symbian Phones")
set (CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples Using Gammu")
set (CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Gammu Manual")
set (CPACK_COMPONENT_MEDIA_DISPLAY_NAME "Media Files")
set (CPACK_COMPONENT_DLLS_HIDDEN TRUE)
set (CPACK_COMPONENT_DLLS_REQUIRED TRUE)
set (CPACK_COMPONENT_LIBRARY_REQUIRED TRUE)
set (CPACK_COMPONENT_GAMMU_DESCRIPTION "The gammu.exe program.")
set (CPACK_COMPONENT_SMSD_DESCRIPTION "Gammu SMS Daemon which automatically sends and receives messages.")
set (CPACK_COMPONENT_LIBRARY_DESCRIPTION "Gammu library.")
set (CPACK_COMPONENT_HEADERS_DESCRIPTION "C headers for development own programs using Gammu library.")
set (CPACK_COMPONENT_UTILS_DESCRIPTION "Utility scripts, mostly written using bourne shell, which you need to install on your own.")
set (CPACK_COMPONENT_MANPAGES_DESCRIPTION "Manual pages for programs and configuration files.")
set (CPACK_COMPONENT_DOCS_DESCRIPTION "User documentation in text files.")
set (CPACK_COMPONENT_PKGCONFIG_DESCRIPTION "Data for pkg-config program (automatic finding of compiler parameters for libraries).")
set (CPACK_COMPONENT_SYMBIAN_DESCRIPTION "Applet for Symbian phones, install it to phone to communicate with them using Gammu.")
set (CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Examples showing how to use Gammu, in PHP, Perl or C.")
set (CPACK_COMPONENT_MANUAL_DESCRIPTION "User and Developer Manual")
set (CPACK_COMPONENT_MEDIA_DESCRIPTION "Various media files which can be used with Gammu.")
set (CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Programs and libraries for general usage.")
set (CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Headers and documentation used for development using Gammu.")
set (CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION "Gammu documentation and usage examples.")
set(CPACK_COMPONENT_GAMMU_DEPENDS library)
if (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
set(CPACK_COMPONENT_LIBRARY_DEPENDS dlls)
endif (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
set(CPACK_COMPONENT_SMSD_DEPENDS library)
set(CPACK_COMPONENT_HEADERS_DEPENDS library)
set(CPACK_COMPONENT_UTILS_DEPENDS gammu)
set(CPACK_COMPONENT_PKGCONFIG_DEPENDS headers)
set (CPACK_COMPONENT_GAMMU_GROUP "Runtime")
set (CPACK_COMPONENT_SMSD_GROUP "Runtime")
set (CPACK_COMPONENT_UTILS_GROUP "Runtime")
set (CPACK_COMPONENT_LIBRARY_GROUP "Runtime")
set (CPACK_COMPONENT_HEADERS_GROUP "Development")
set (CPACK_COMPONENT_PKGCONFIG_GROUP "Development")
set (CPACK_COMPONENT_MANPAGES_GROUP "Documentation")
set (CPACK_COMPONENT_DOCS_GROUP "Documentation")
set (CPACK_COMPONENT_EXAMPLES_GROUP "Documentation")
set (CPACK_COMPONENT_MANUAL_GROUP "Documentation")
set (CPACK_COMPONENT_MEDIA_GROUP "Documentation")
set (CPACK_ALL_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_GAMMU_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_SMSD_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
set (CPACK_COMPONENT_UTILS_INSTALL_TYPES Full)
set (CPACK_COMPONENT_MANPAGES_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_DOCS_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_PKGCONFIG_INSTALL_TYPES Developer Full)
set (CPACK_COMPONENT_SYMBIAN_INSTALL_TYPES Standard Developer Full)
set (CPACK_COMPONENT_EXAMPLES_INSTALL_TYPES Developer Full)
set (CPACK_COMPONENT_MANUAL_INSTALL_TYPES Developer Full)
set (CPACK_COMPONENT_MEDIA_INSTALL_TYPES Full)
if (WIN32 AND NOT CYGWIN)
set (CPACK_PACKAGE_INSTALL_DIRECTORY "Gammu ${GAMMU_VERSION}")
set (CPACK_NSIS_DISPLAY_NAME "Gammu ${GAMMU_VERSION}")
set (CPACK_NSIS_HELP_LINK "https://wammu.eu/support/")
set (CPACK_NSIS_URL_INFO_ABOUT "https://wammu.eu/gammu/")
set (CPACK_NSIS_CONTACT "[email protected]")
set (CPACK_NSIS_MODIFY_PATH ON)
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
ExecWait \\\"$INSTDIR\\\\bin\\\\gammu-smsd.exe -e \\\"
")
SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
ExecWait \\\"$INSTDIR\\\\bin\\\\gammu-smsd.exe -E \\\"
")
else (WIN32 AND NOT CYGWIN)
set (CPACK_STRIP_FILES "gammu")
set (CPACK_SOURCE_STRIP_FILES "")
endif (WIN32 AND NOT CYGWIN)
include (CPack)
# Test files for Gammu
set (RINGTONE_TEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/media/axelf.txt)
set (LOGO_TEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/media/aliens.nlm)
# Transverse to dirs
add_subdirectory(include)
add_subdirectory(libgammu)
add_subdirectory(helper)
add_subdirectory(tests)
add_subdirectory(smsd)
add_subdirectory(gammu)
add_subdirectory(gammu-detect)
add_subdirectory(locale)
add_subdirectory(utils)
option(INSTALL_DOC "Install documentation" ON)
if(INSTALL_DOC)
install (
FILES ${DOCS}
DESTINATION "${INSTALL_DOC_DIR}"
COMPONENT "docs"
)
add_subdirectory(docs/config)
add_subdirectory(docs/manual)
add_subdirectory(docs/examples)
add_subdirectory(docs/sql)
add_subdirectory(docs/man)
endif(INSTALL_DOC)
add_subdirectory(contrib)