Translation update done using Pootle.
[gammu.git] / CMakeLists.txt
blob6e5bcf8f82419d68c3d3174e020a702300a0e439
1 # cmake <http://www.cmake.org> build file for Gammu
2 # Copyright (c) 2007 - 2010 Michal Cihar
3 # vim: expandtab sw=4 ts=4 sts=4:
5 # I didn't check older versions
6 # However 2.6 is needed for crosscompiling, Cpack components and other useful things
7 cmake_minimum_required (VERSION 2.4.2)
8 INCLUDE (CMakeForceCompiler)
9 if (ENABLE_TIGER)
10     # In order to build for tiger we need to force to gcc-4.0
11     CMAKE_FORCE_C_COMPILER   (gcc-4.0 i686-apple-darwin10-gcc-4.0.1)
12 endif(ENABLE_TIGER)
14 project (Gammu C)
16 # Where to lookup modules
17 set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
19 # Silent some warnings from CMake 2.6
20 if(COMMAND cmake_policy)
21     cmake_policy(SET CMP0003 NEW)
22 endif(COMMAND cmake_policy)
24 option (COVERAGE "Add flags for Coverage analysis" OFF)
25 option (ONLINE_TESTING "Enable testing of parts which use remote servers" OFF)
26 option (PSQL_TESTING "Enable testing of PostgreSQL SMSD backend" OFF)
27 option (MYSQL_TESTING "Enable testing of MySQL SMSD backend" OFF)
29 option (LARGE_FILES "Support for large files" ON)
30 if (LARGE_FILES)
31     add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
32 endif (LARGE_FILES)
34 if (CMAKE_CROSSCOMPILING AND MINGW)
35     set (GAMMU_TEST_SUFFIX ".exe")
36 else (CMAKE_CROSSCOMPILING AND MINGW)
37     set (GAMMU_TEST_SUFFIX "")
38 endif (CMAKE_CROSSCOMPILING AND MINGW)
40 # Set version
41 set (GAMMU_VERSION "1.28.96" CACHE INTERNAL "")
42 string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\1" "GAMMU_VERSION_MAJOR" "${GAMMU_VERSION}")
43 string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\2" "GAMMU_VERSION_MINOR" "${GAMMU_VERSION}")
44 string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\3" "GAMMU_VERSION_PATCH" "${GAMMU_VERSION}")
45 math(EXPR GAMMU_VERSION_NUM "${GAMMU_VERSION_MAJOR} * 10000 + ${GAMMU_VERSION_MINOR} * 100 + ${GAMMU_VERSION_PATCH}")
46 message (STATUS "Configuring ${CMAKE_PROJECT_NAME} ${GAMMU_VERSION}")
48 set (GAMMU_SOVERSION "7" CACHE INTERNAL "")
50 if ("${Gammu_BINARY_DIR}" STREQUAL "${Gammu_SOURCE_DIR}")
51     message ("Warning: In tree build is not recommended way to build Gammu.")
52 endif ("${Gammu_BINARY_DIR}" STREQUAL "${Gammu_SOURCE_DIR}")
54 # For debugging
55 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
56 #    set (CMAKE_VERBOSE_MAKEFILE ON)
57     set (DEBUG 1)
58 else (CMAKE_BUILD_TYPE STREQUAL "Debug")
59     set (DEBUG 0)
60 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
62 # Standard packages
63 include (CheckCSourceCompiles)
64 include (CheckCCompilerFlag)
65 include (CheckIncludeFile)
66 include (CheckIncludeFiles)
67 include (CheckFunctionExists)
68 include (CheckSymbolExists)
69 include (CheckTypeSize)
70 include (CheckLibraryExists)
71 include (FindPkgConfig)
73 # Packages in our sources (mostly taken from KDE)
74 include (MacroOptionalFindPackage)
75 include (MacroAddDLL)
76 include (MacroGammuOption)
77 include (MacroTuneCompiler)
79 # WE use pkgconfig later
80 find_package (PkgConfig)
82 # Standard packages
83 macro_optional_find_package (Doxygen)
85 # I'd say this is task of CMake to export this
86 check_symbol_exists (__clang__ "" CLANG_COMPILER)
87 if (APPLE)
88     if (ENABLE_TIGER)
89         # if we do for 10.4
90         MACRO_TUNE_COMPILER("-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk")
91         MACRO_TUNE_COMPILER("-arch i386")
92     else (ENABLE_TIGER)
93         # else try to be compatible with 10.5
94         MACRO_TUNE_COMPILER("-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
95         MACRO_TUNE_COMPILER("-arch x86_64")
96     endif (ENABLE_TIGER)
97 endif (APPLE)
99 # Configuration checks
100 check_symbol_exists (strncasecmp "string.h" HAVE_STRNCASECMP)
101 check_symbol_exists (strcasecmp "string.h" HAVE_STRCASECMP)
102 check_symbol_exists (_strnicmp "string.h" HAVE_STRNICMP)
103 check_symbol_exists (_stricmp "string.h" HAVE_STRICMP)
104 check_function_exists (strcasestr HAVE_STRCASESTR)
105 check_function_exists (strchrnul HAVE_STRCHRNUL)
106 check_function_exists (strtoull HAVE_STRTOULL)
107 check_include_file (dirent.h HAVE_DIRENT_H)
108 check_include_file (sys/ioctl.h HAVE_SYS_IOCTL_H)
109 check_include_file (sys/utsname.h HAVE_SYS_UTSNAME_H)
110 check_include_file (unistd.h HAVE_UNISTD_H)
112 check_include_file (wchar.h HAVE_WCHAR_H)
113 if (HAVE_WCHAR_H)
114     check_include_files ("wchar.h;wctype.h" HAVE_WCTYPE_H)
115     check_symbol_exists (iswspace "wchar.h;wctype.h" HAVE_ISWSPACE)
116     check_symbol_exists (towlower "wchar.h;wctype.h" HAVE_TOWLOWER)
117 else (HAVE_WCHAR_H)
118     check_include_file (wctype.h HAVE_WCTYPE_H)
119     check_symbol_exists (iswspace "wctype.h" HAVE_ISWSPACE)
120     check_symbol_exists (towlower "wctype.h" HAVE_TOWLOWER)
121 endif (HAVE_WCHAR_H)
122 check_symbol_exists (I_SETSIG "stropts.h" HAVE_I_SETSIG)
123 check_include_file (strings.h HAVE_STRINGS_H)
124 # These checks are required for check_type_size() on cmake < 2.6.0
125 check_include_file (sys/types.h HAVE_SYS_TYPES_H)
126 check_include_file (stdint.h HAVE_STDINT_H)
127 check_include_file (stddef.h HAVE_STDDEF_H)
128 check_function_exists (scandir HAVE_SCANDIR)
129 check_function_exists (alphasort HAVE_ALPHASORT)
130 check_symbol_exists (getopt "unistd.h" HAVE_GETOPT)
131 check_symbol_exists (getopt_long "getopt.h" HAVE_GETOPT_LONG)
132 check_symbol_exists (daemon "unistd.h" HAVE_DAEMON_UNISTD)
133 check_symbol_exists (daemon "stdlib.h" HAVE_DAEMON_STDLIB)
134 check_symbol_exists (kill "signal.h" HAVE_KILL)
135 check_symbol_exists (getpwnam "pwd.h" HAVE_GETPWNAM)
136 check_symbol_exists (getgrnam "grp.h" HAVE_GETGRNAM)
137 check_symbol_exists (getpwuid "pwd.h" HAVE_GETPWUID)
138 check_symbol_exists (getuid "unistd.h" HAVE_GETUID)
139 check_symbol_exists (initgroups "grp.h" HAVE_INITGROUPS)
140 check_symbol_exists (setuid "unistd.h" HAVE_SETUID)
141 check_symbol_exists (setgid "unistd.h" HAVE_SETGID)
142 check_symbol_exists (SIGHUP "signal.h" HAVE_SIGHUP)
143 check_symbol_exists (dup "unistd.h" HAVE_DUP_UNISTD_H)
144 check_symbol_exists (getpid "unistd.h" HAVE_GETPID)
145 check_symbol_exists (getpass "unistd.h" HAVE_GETPASS)
146 check_symbol_exists (alarm "unistd.h" HAVE_ALARM)
147 check_symbol_exists (dup "io.h" HAVE_DUP_IO_H)
148 check_symbol_exists (shmget "sys/shm.h" HAVE_SHM)
149 check_c_source_compiles ("
150 #define _XOPEN_SOURCE
151 #define _BSD_SOURCE
152 #include <time.h>
154 int main(void) {
155     struct tm timestruct;
156     strptime(\"11:22\", \"%H:%M\", &timestruct);
157     return 0;
158 }" HAVE_STRPTIME)
159 check_c_source_compiles ("
160 #include <stdio.h>
161 #include <syslog.h>
162 #include <stdarg.h>
164 int main(void) {
165     syslog(LOG_NOTICE, \"aaa %d\", 1);
166     return 0;
168 "  HAVE_SYSLOG)
169 # Some compilers (eg. BCC) have this in ctype.h
170 if (NOT HAVE_TOWLOWER)
171     check_symbol_exists (towlower "ctype.h" HAVE_TOWLOWER_CTYPE)
172     if (HAVE_TOWLOWER_CTYPE)
173         set (HAVE_TOWLOWER ${HAVE_TOWLOWER_CTYPE} CACHE INTERNAL "")
174     endif (HAVE_TOWLOWER_CTYPE)
175 endif (NOT HAVE_TOWLOWER)
177 # Standard packages
178 macro_optional_find_package (Threads)
180 # Used (optionally for testing)
181 find_program(SH_BIN sh)
182 find_program(BASH_BIN bash)
183 find_program(SQLITE_BIN sqlite3)
184 find_program(SED_BIN sed)
185 find_program(MYSQL_BIN mysql)
186 find_program(PSQL_BIN psql)
188 # Check for Python
189 set (BUILD_PYTHON "" CACHE FILEPATH "Path to python interpreter")
191 if (BUILD_PYTHON)
192     set (WITH_PYTHON TRUE CACHE BOOL "Build Python bindings")
193     set (PYTHON_EXECUTABLE ${BUILD_PYTHON})
194     execute_process(
195         COMMAND
196             ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())"
197         OUTPUT_VARIABLE PYTHON_INCLUDE_PATH
198         OUTPUT_STRIP_TRAILING_WHITESPACE
199         )
200     execute_process(
201         COMMAND
202             ${PYTHON_EXECUTABLE} -c "import sys; print('.'.join([str(x) for x in sys.version_info[:2]]))"
203         OUTPUT_VARIABLE PYTHON_VERSION
204         OUTPUT_STRIP_TRAILING_WHITESPACE
205         )
206     message (STATUS "Compiling for Python ${PYTHON_VERSION}")
208     string (REPLACE "." "" PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
209     find_library (PYTHON_LIBRARY
210         NAMES python${PYTHON_VERSION_NO_DOTS} python${PYTHON_VERSION}
211         PATHS
212           [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION}\\InstallPath]/libs
213         PATH_SUFFIXES
214           python${PYTHON_VERSION}/config
215         # Avoid finding the .dll in the PATH.  We want the .lib.
216         NO_SYSTEM_ENVIRONMENT_PATH
217       )
218 else (BUILD_PYTHON)
219     find_package(PythonInterp)
220     find_package(PythonLibs)
222     if (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
223         set (WITH_PYTHON TRUE CACHE BOOL "Build Python bindings")
224     else (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
225         set (WITH_PYTHON FALSE CACHE BOOL "Build Python bindings" FORCE)
226     endif (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
227 endif (BUILD_PYTHON)
229 if (PYTHON_EXECUTABLE)
230     execute_process(
231         COMMAND ${PYTHON_EXECUTABLE} -c "import sys; print(sys.version_info[0])"
232         OUTPUT_VARIABLE PYTHON_MAJOR_VERSION
233         OUTPUT_STRIP_TRAILING_WHITESPACE
234         )
235     if ("${PYTHON_MAJOR_VERSION}" GREATER 2)
236         message("Python 3.x is not currently supported!")
237         set (WITH_PYTHON FALSE CACHE BOOL "Build Python bindings" FORCE)
238     endif ("${PYTHON_MAJOR_VERSION}" GREATER 2)
239 endif (PYTHON_EXECUTABLE)
241 # Packages in sources
242 macro_optional_find_package (MySQL)
243 macro_optional_find_package (Postgres)
244 macro_optional_find_package (LibDBI)
245 macro_optional_find_package (Libintl)
246 macro_optional_find_package (Iconv)
247 macro_optional_find_package (CURL)
248 macro_optional_find_package (Glib)
249 macro_optional_find_package (Gobject)
251 # Gudev stuff
252 pkg_check_modules(GUDEV gudev-1.0)
254 if (CMAKE_CROSSCOMPILING AND MINGW)
255     set (HAVE_WINT_T 4 CACHE INTERNAL "")
256     set (HAVE_WCHAR_T 4 CACHE INTERNAL "")
257 else (CMAKE_CROSSCOMPILING AND MINGW)
258     # Search for needed includes and functions
259     if (HAVE_WCHAR_H)
260         set (CMAKE_EXTRA_INCLUDE_FILES wchar.h)
261         check_type_size (wchar_t HAVE_WCHAR_T)
262         check_type_size (wint_t  HAVE_WINT_T)
263     endif (HAVE_WCHAR_H)
264     set (CMAKE_EXTRA_INCLUDE_FILES)
265 endif (CMAKE_CROSSCOMPILING AND MINGW)
267 set (CMAKE_EXTRA_INCLUDE_FILES stdio.h)
268 check_type_size (ssize_t HAVE_SSIZE_T)
269 set (CMAKE_EXTRA_INCLUDE_FILES)
270 if (HAVE_UNISTD_H)
271     set (CMAKE_EXTRA_INCLUDE_FILES unistd.h)
272     check_type_size(intptr_t HAVE_INTPTR_T)
273     set (CMAKE_EXTRA_INCLUDE_FILES)
274 else(HAVE_UNISTD_H)
275     check_type_size(intptr_t HAVE_INTPTR_T)
276 endif (HAVE_UNISTD_H)
278 check_c_source_compiles ("
279 #include <stdio.h>
281 int main(void) {
282     printf( __FUNCTION__);
283     return 0;
285 "  HAVE_MACRO_FUNCTION)
287 check_c_source_compiles ("
288 #include <time.h>
290 int main(void) {
291     struct tm tm;
292     tm.tm_zone;
293     return 0;
295 "  HAVE_STRUCT_TM_TM_ZONE)
297 check_c_source_compiles ("
298 #include <stdio.h>
300 int main(void) {
301     printf( __FUNC__);
302     return 0;
304 "  HAVE_MACRO_FUNC)
307 OPTION(WITH_BLUETOOTH "Bluetooth support" ON)
308 if (WITH_BLUETOOTH)
309     if (WIN32 AND NOT CYGWIN)
310         # FIXME: This is currently hardcoded here, maybe there is test?
311         set(BLUETOOTH_FOUND ON)
312         message(STATUS "Using Windows native Bluetooth")
313         set(BLUETOOTH_SEARCH TRUE)
314     elseif(CYGWIN)
315         message(STATUS "Bluetooth is currently not supported in Cygwin")
316         message(STATUS "If you need it, contact us")
317     else (WIN32 AND NOT CYGWIN)
318         find_package (Bluez)
319         if (BLUEZ_FOUND)
320             set(BLUETOOTH_FOUND ON)
321             set(BLUETOOTH_SEARCH TRUE)
322             message(STATUS "Using BlueZ stack")
323         endif (BLUEZ_FOUND)
324         find_package (BSDBluetooth)
325         if (BSD_BLUE_FOUND)
326             set(BLUETOOTH_FOUND ON)
327             message(STATUS "Using BSD Bluetooth stack")
328             check_library_exists(bluetooth sdp_service_search_attribute "" HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE)
329             check_library_exists(bluetooth bt_devinquiry "" HAVE_BT_DEVINQUIRY)
330             if (HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE AND HAVE_BT_DEVINQUIRY)
331                 set(BLUETOOTH_SEARCH TRUE)
332             endif (HAVE_SDP_SERVICE_SEARCH_ATTRIBUTE AND HAVE_BT_DEVINQUIRY)
333         endif (BSD_BLUE_FOUND)
334         find_package (OSXBluetooth)
335         if (OSX_BLUE_FOUND)
336             set(BLUETOOTH_FOUND ON)
337             set(BLUETOOTH_SEARCH FALSE)
338             message(STATUS "Using OSX Bluetooth stack")
339         endif (OSX_BLUE_FOUND)
340     endif (WIN32 AND NOT CYGWIN)
341 else (WITH_BLUETOOTH)
342     set(BLUETOOTH_FOUND FALSE)
343     set(BLUETOOTH_INCLUDE_DIR)
344     set(BLUETOOTH_INCLUDES)
345     set(BLUETOOTH_LIBRARY)
346     set(BLUETOOTH_LIBRARIES)
347 endif (WITH_BLUETOOTH)
349 if (BLUETOOTH_FOUND)
350     message(STATUS "Bluetooth support enabled")
351 else (BLUETOOTH_FOUND)
352     if (WITH_BLUETOOTH AND NOT CYGWIN)
353         message("Bluetooth support disabled, please install libbluetooth-dev or equivalent to enable Bluetooth.")
354     endif (WITH_BLUETOOTH AND NOT CYGWIN)
355 endif (BLUETOOTH_FOUND)
357 macro_gammu_option (BLUETOOTH_RF_SEARCHING "Searching for RF channels with Bluetooth stack" ON BLUETOOTH_FOUND BLUETOOTH_SEARCH)
358 if (WITH_BLUETOOTH_RF_SEARCHING)
359     set (BLUETOOTH_RF_SEARCHING ON)
360 endif (WITH_BLUETOOTH_RF_SEARCHING)
362 OPTION(WITH_USB "Native USB support" ON)
363 if (WITH_USB)
364     find_package (LibUSB)
365 endif (WITH_USB)
367 OPTION(WITH_IRDA "IrDA support" ON)
368 if (WITH_IRDA)
369     if (WIN32 AND NOT CYGWIN)
370         # FIXME: This is currently hardcoded here, maybe there is test?
371         set (IRDA_FOUND TRUE)
372         message(STATUS "Using Windows native IrDA")
373     elseif(CYGWIN)
374         message(STATUS "IrDA is currently not supported in Cygwin")
375         message(STATUS "If you need it, contact us")
376         set (IRDA_FOUND FALSE)
377     else (WIN32 AND NOT CYGWIN)
378         check_c_source_compiles (
379             "
380 #include <sys/socket.h>
381 #include <linux/types.h>
382 #include <sys/ioctl.h>
383 #include <linux/irda.h>
384     int main(int argc, char **argv) {
385         return 0;
386     }
387             "
388             IRDA_FOUND
389             )
390         if (IRDA_FOUND)
391             message(STATUS "Using Linux native IrDA")
392         endif (IRDA_FOUND)
393     endif (WIN32 AND NOT CYGWIN)
394 else (WITH_IRDA)
395     set (IRDA_FOUND FALSE)
396 endif (WITH_IRDA)
398 if (IRDA_FOUND)
399     message(STATUS "IrDA support enabled")
400 endif (IRDA_FOUND)
402 if (MYSQL_FOUND)
403     set (HAVE_MYSQL_MYSQL_H TRUE)
404 endif (MYSQL_FOUND)
406 if (POSTGRES_FOUND)
407     set (HAVE_POSTGRESQL_LIBPQ_FE_H TRUE)
408 endif (POSTGRES_FOUND)
410 set (GAMMU_LIBS "")
412 if (BLUEZ_FOUND)
413     if (NOT "${BLUEZ_LIBRARIES}" STREQUAL "")
414         set (GAMMU_LIBS "${GAMMU_LIBS} -l${BLUEZ_LIBRARIES}")
415     endif (NOT "${BLUEZ_LIBRARIES}" STREQUAL "")
416 endif (BLUEZ_FOUND)
418 if (BSD_BLUE_FOUND)
419     if (NOT "${BSD_BLUE_LIBRARIES}" STREQUAL "")
420         set (GAMMU_LIBS "${GAMMU_LIBS} -l${BSD_BLUE_LIBRARIES}")
421     endif (NOT "${BSD_BLUE_LIBRARIES}" STREQUAL "")
422 endif (BSD_BLUE_FOUND)
424 if (ICONV_FOUND)
425     if (NOT "${ICONV_LIBRARIES}" STREQUAL "")
426         set (GAMMU_LIBS "${GAMMU_LIBS} -l${ICONV_LIBRARIES}")
427     endif (NOT "${ICONV_LIBRARIES}" STREQUAL "")
428 endif (ICONV_FOUND)
430 if (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
431     set (GAMMU_LIBS "${GAMMU_LIBS} -l${LIBINTL_LIBRARIES}")
432 endif (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
434 if (LIBUSB_FOUND)
435     if (NOT "${LIBUSB_LIBRARIES}" STREQUAL "")
436         set (GAMMU_LIBS "${GAMMU_LIBS} -l${LIBUSB_LIBRARIES}")
437     endif (NOT "${LIBUSB_LIBRARIES}" STREQUAL "")
438 endif (LIBUSB_FOUND)
440 set (SMSD_LIBS "")
442 if (MYSQL_FOUND)
443     if (NOT "${MYSQL_LIBRARIES}" STREQUAL "")
444         set (SMSD_LIBS "${SMSD_LIBS} -l${MYSQL_LIBRARIES}")
445     endif (NOT "${MYSQL_LIBRARIES}" STREQUAL "")
446 endif (MYSQL_FOUND)
448 if (POSTGRES_FOUND)
449     if (NOT "${POSTGRES_LIBRARY}" STREQUAL "")
450         set (SMSD_LIBS "${SMSD_LIBS} -l${POSTGRES_LIBRARY}")
451     endif (NOT "${POSTGRES_LIBRARY}" STREQUAL "")
452 endif (POSTGRES_FOUND)
454 # Tweak compiler flags
455 if(MSVC)
456     # MSVC needs different flags at all
457     MACRO_TUNE_COMPILER("/W3")
458 endif(MSVC)
460 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
461     CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX OR CLANG_COMPILER)
462     # Check for extra compiler flags we want to use
463     if (NOT GAMMU_VERSION_PATCH LESS 90)
464         MACRO_TUNE_COMPILER("-Werror")
465     endif (NOT GAMMU_VERSION_PATCH LESS 90)
467     #
468     # Warnings related flags
469     #
470     MACRO_TUNE_COMPILER("-Wall")
471     MACRO_TUNE_COMPILER("-Werror-implicit-function-declaration")
472     MACRO_TUNE_COMPILER("-Wno-deprecated-declarations")
473     MACRO_TUNE_COMPILER("-Wdeclaration-after-statement")
474     MACRO_TUNE_COMPILER("-Wpointer-arith")
475     MACRO_TUNE_COMPILER("-Wfloat-equal")
476     MACRO_TUNE_COMPILER("-Wbad-function-cast")
477     MACRO_TUNE_COMPILER("-Wmissing-format-attribute")
478     MACRO_TUNE_COMPILER("-Wmissing-noreturn")
479 #   This should be enabled and only public functions exported, but it is far future
480 #    MACRO_TUNE_COMPILER("-Wmissing-prototypes")
481     MACRO_TUNE_COMPILER("-Wpointer-arith")
482     MACRO_TUNE_COMPILER("-Wshadow")
483     MACRO_TUNE_COMPILER("-Wstrict-prototypes")
484     MACRO_TUNE_COMPILER("-Wsign-compare")
485 #   We need some typecasting (especially for iconv)
486 #    MACRO_TUNE_COMPILER("-Wcast-qual")
488     # Does not work well
489     #MACRO_TUNE_COMPILER("-Wunreachable-code")
491     # Just silent this for now, too much code to fix here
492     MACRO_TUNE_COMPILER("-Wno-pointer-sign")
494     # Check format strings
495     MACRO_TUNE_COMPILER("-Wshadow")
496     MACRO_TUNE_COMPILER("-Wformat=2")
497     MACRO_TUNE_COMPILER("-Wno-format-y2k")
498     MACRO_TUNE_COMPILER("-Wno-format-nonliteral")
499     # Win32 implementation of gettext does not allow us to use so strict warnings
500     if (WIN32 AND NOT CYGWIN)
501         MACRO_TUNE_COMPILER("-Wno-format-nonliteral")
502         MACRO_TUNE_COMPILER("-Wno-format-security")
503     endif (WIN32 AND NOT CYGWIN)
505     # Win32 implementation of gettext does not allow us to use so strict warnings
506     if (COVERAGE)
507         MACRO_TUNE_COMPILER_LINKER("-fprofile-arcs -ftest-coverage")
508     endif (COVERAGE)
510     # This is extremely noisy, use only in debug builds
511     if (DEBUG)
512         MACRO_TUNE_COMPILER("-Wextra")
513         # Just silent this for now, too much code to fix here
514         MACRO_TUNE_COMPILER("-Wno-unused-parameter")
515         # Not sure if this is safe for all architectures
516     endif (DEBUG)
518     #
519     # Security related flags
520     #
521     if (NOT CLANG_COMPILER)
522         set (ENABLE_PROTECTION ON CACHE BOOL "Enable compile time protections (stack, read only code, fortify in libc...)")
523     endif (NOT CLANG_COMPILER)
524     if (ENABLE_PROTECTION)
525         # Need to enable -O to make fortify work
526         set (CMAKE_C_FLAGS_DEBUG "-g -O")
527         add_definitions(-D_FORTIFY_SOURCE=2)
529         # Text address randomisation, disabled for now, seems to cause problems
530         #    MACRO_TUNE_COMPILER("-fPIE")
531         #    MACRO_TUNE_LINKER("-pie")
532         # These do not work on Windows right now
533         if (NOT WIN32)
534             # Stack protector
535             MACRO_TUNE_COMPILER("-fstack-protector")
536             # Mark code read only
537             MACRO_TUNE_LINKER("-Wl,-zrelro")
538         endif (NOT WIN32)
539     endif (ENABLE_PROTECTION)
541     #
542     # Other flags
543     #
545     if (WIN32 AND NOT CYGWIN AND BUILD_SHARED_LIBS)
546         MACRO_TUNE_LINKER("-Wl,--enable-auto-import")
547     endif (WIN32 AND NOT CYGWIN AND BUILD_SHARED_LIBS)
549     MACRO_TUNE_LINKER("-Wl,--as-needed")
550     set (PIC ON CACHE BOOL "Compile PIC code")
551     if (PIC)
552         MACRO_TUNE_COMPILER("-fPIC")
553     endif (PIC)
554     # Specs for MinGW to change msvcrt
555     # This is not supported by MinGW and is broken currently
556 #    if (CMAKE_COMPILER_IS_MINGW)
557 #        MACRO_TUNE_COMPILER("-specs=${Gammu_SOURCE_DIR}/cmake/mingw.spec")
558 #        add_definitions(-D_MSVCRT_VERSION__=0x090)
559 #    endif (CMAKE_COMPILER_IS_MINGW)
560 endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
561     CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX OR CLANG_COMPILER)
563 if(BORLAND)
564     # Borland
565     # Suggests parenthesis
566     MACRO_TUNE_COMPILER("-wprc")
567     # Do not warn about unused params
568     MACRO_TUNE_COMPILER("-w-par")
569     # Warn about unused vars
570     MACRO_TUNE_COMPILER("-wuse")
571 endif(BORLAND)
574 # Define required libraries for gammu library if it is static
575 if (BUILD_SHARED_LIBS)
576     set (GAMMU_PRIVATE_LIBS "" CACHE INTERNAL "Private libraries for gammu library")
577     set (SMSD_PRIVATE_LIBS "" CACHE INTERNAL "Private libraries for gammu smsd library")
578 else (BUILD_SHARED_LIBS)
579     string(REGEX REPLACE "-l(/usr)?(/local)?/lib(64)?/lib([^ ]*).so" "-l\\4" G_LIB "${GAMMU_LIBS}")
580     string(REGEX REPLACE "-l(/usr)?(/local)?/lib(64)?/lib([^ ]*).so" "-l\\4" S_LIB "${SMSD_LIBS}")
581     set (GAMMU_PRIVATE_LIBS "${G_LIB}" CACHE INTERNAL "Private libraries for gammu library")
582     set (SMSD_PRIVATE_LIBS "${S_LIB}" CACHE INTERNAL "Private libraries for gammu smsd library")
583 endif (BUILD_SHARED_LIBS)
585 set (DOCS
586     README
587     ChangeLog
588     COPYING
589     )
591 # OpenCellID API key
592 set (OPENCELLID_API_KEY "2623b0e70e9fa77754a3db53f3cb6458" CACHE STRING "OpenCellID API key")
593 mark_as_advanced (OPENCELLID_API_KEY)
595 if (CMAKE_USE_PTHREADS_INIT)
596     set (HAVE_PTHREAD ON)
597 endif (CMAKE_USE_PTHREADS_INIT)
599 # Install paths
600 if ("${MATH_LIBRARIES}" MATCHES "/lib64/")
601     set (LIB_SUFFIX "64" CACHE STRING "Suffix of library directory (usually 64 or empty)")
602 else ("${MATH_LIBRARIES}" MATCHES "/lib64/")
603     set (LIB_SUFFIX "" CACHE STRING "Suffix of library directory (usually 64 or empty)")
604 endif ("${MATH_LIBRARIES}" MATCHES "/lib64/")
607 set (INSTALL_BIN_DIR "bin" CACHE STRING "Path for binaries installation")
608 mark_as_advanced (INSTALL_BIN_DIR)
610 set (INSTALL_LIB_DIR "lib${LIB_SUFFIX}" CACHE STRING "Path for libraries installation")
611 mark_as_advanced (INSTALL_LIB_DIR)
613 set (INSTALL_LIBDATA_DIR "lib${LIB_SUFFIX}" CACHE STRING "Path for libraries data (eg. pkgconfig data) installation")
614 mark_as_advanced (INSTALL_LIBDATA_DIR)
616 set (INSTALL_INC_DIR "include/gammu" CACHE STRING "Path for includes installation")
617 mark_as_advanced (INSTALL_INC_DIR)
619 set (INSTALL_LOC_DIR "share/locale" CACHE STRING "Path for locales installation")
620 mark_as_advanced (INSTALL_LOC_DIR)
622 set (INSTALL_DOC_DIR "share/doc/gammu" CACHE STRING "Path for documentation installation")
623 mark_as_advanced (INSTALL_DOC_DIR)
625 set (INSTALL_MAN_DIR "share/man" CACHE STRING "Path for man pages installation")
626 mark_as_advanced (INSTALL_MAN_DIR)
628 # Phone and protocol configuration
630 # Nokia phones
631 macro_gammu_option (NOKIA_SUPPORT "Nokia support" ON ON ON)
633 macro_gammu_option (MBUS2 "Nokia MBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
634 macro_gammu_option (FBUS2 "Nokia FBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
635 macro_gammu_option (FBUS2DLR3 "Nokia FBUS2DLR3 protocol" ON WITH_NOKIA_SUPPORT ON)
636 macro_gammu_option (DKU2PHONET "Nokia DKU2PHONET protocol" ON WITH_NOKIA_SUPPORT ON)
637 macro_gammu_option (DKU2AT "Nokia DKU2AT protocol" ON WITH_NOKIA_SUPPORT ON)
638 macro_gammu_option (DKU5FBUS2 "Nokia DKU5FBUS2 protocol" ON WITH_NOKIA_SUPPORT ON)
639 macro_gammu_option (FBUS2PL2303 "Nokia FBUS2PL2303 protocol" ON WITH_NOKIA_SUPPORT ON)
641 macro_gammu_option (FBUS2BLUE "Nokia FBUS2BLUE protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
642 macro_gammu_option (PHONETBLUE "Nokia PHONETBLUE protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
643 macro_gammu_option (BLUEFBUS2 "Nokia BLUEFBUS2 protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
644 macro_gammu_option (BLUEPHONET "Nokia BLUEPHONET protocol" ON WITH_NOKIA_SUPPORT BLUETOOTH_FOUND)
646 macro_gammu_option (IRDAPHONET "Nokia IRDAPHONET protocol" ON WITH_NOKIA_SUPPORT IRDA_FOUND)
647 macro_gammu_option (FBUS2IRDA "Nokia FBUS2IRDA protocol" ON WITH_NOKIA_SUPPORT IRDA_FOUND)
649 macro_gammu_option (NOKIA3320 "Nokia 3320 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
650 macro_gammu_option (NOKIA650 "Nokia 650 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
651 macro_gammu_option (NOKIA6110 "Nokia 61xx and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
652 macro_gammu_option (NOKIA6510 "Nokia 6510 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
653 macro_gammu_option (DCT4_CALENDAR_6210 "Force using 6210 frames for calendar for DCT4 phones" OFF WITH_NOKIA_SUPPORT WITH_NOKIA6510)
654 if (WITH_DCT4_CALENDAR_6210)
655     set (GSM_FORCE_DCT4_CALENDAR_6210 TRUE)
656 endif (WITH_DCT4_CALENDAR_6210)
657 macro_gammu_option (NOKIA7110 "Nokia 7110 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
658 macro_gammu_option (NOKIA9210 "Nokia 9210 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
659 if (WITH_NOKIA7110 OR WITH_NOKIA9210)
660     set (wITH_71_92 ON)
661 else (WITH_NOKIA7110 OR WITH_NOKIA9210)
662     set (wITH_71_92)
663 endif (WITH_NOKIA7110 OR WITH_NOKIA9210)
664 macro_gammu_option (N71_92INCOMINGINFO "Nokia 62xx/71xx/9xxx incoming call/SMS info" OFF WITH_NOKIA_SUPPORT WITH_71_92)
665 macro_gammu_option (NOKIA3650 "Nokia 3650 and compatible phones support" ON WITH_NOKIA_SUPPORT ON)
667 # AT phones
668 macro_gammu_option (AT_SUPPORT "AT support" ON ON ON)
670 macro_gammu_option (AT "AT protocol" ON WITH_AT_SUPPORT ON)
671 macro_gammu_option (BLUEAT "AT protocol over Bluetooth" ON WITH_AT_SUPPORT BLUETOOTH_FOUND)
672 macro_gammu_option (IRDAAT "AT protocol over IrDA" ON WITH_AT_SUPPORT IRDA_FOUND)
674 macro_gammu_option (ATGEN "AT phones support" ON WITH_AT_SUPPORT ON)
676 macro_gammu_option (ALCATEL_SUPPORT "Alcatel support" ON WITH_AT_SUPPORT ON)
678 macro_gammu_option (ALCABUS "Alcatel protocol" ON WITH_ALCATEL_SUPPORT ON)
680 macro_gammu_option (ALCATEL "Alcatel phones support" ON WITH_ALCATEL_SUPPORT ON)
682 # OBEX phones
683 macro_gammu_option (OBEX_SUPPORT "OBEX compatible phones support" ON ON ON)
685 macro_gammu_option (BLUEOBEX "OBEX protocol over Bluetooth" ON WITH_OBEX_SUPPORT BLUETOOTH_FOUND)
686 macro_gammu_option (IRDAOBEX "OBEX protocol over IrDA" ON WITH_OBEX_SUPPORT IRDA_FOUND)
688 macro_gammu_option (OBEXGEN "Generic OBEX phones support" ON WITH_OBEX_SUPPORT ON)
689 macro_gammu_option (ATOBEX "AT with OBEX phones support" ON WITH_OBEX_SUPPORT WITH_AT_SUPPORT)
690 macro_gammu_option (ATOBEX_AUTO_MODE "Automatic switching to OBEX for AT+MODE capable phones" OFF WITH_ATOBEX_SUPPORT ON)
692 macro_gammu_option (GNAPPLET_SUPPORT "Symbian phones support (gnapplet)" ON WITH_NOKIA_SUPPORT ON)
693 macro_gammu_option (BLUEGNAPBUS "GNAPBUS protocol over Bluetooth" ON WITH_GNAPPLET_SUPPORT BLUETOOTH_FOUND)
694 macro_gammu_option (IRDAGNAPBUS "GNAPBUS protocol over IrDA" ON WITH_GNAPPLET_SUPPORT IRDA_FOUND)
696 macro_gammu_option (GNAPGEN "Gnapplet phones support" ON WITH_GNAPPLET_SUPPORT ON)
698 # Some generic configurations
699 macro_gammu_option (CELLBROADCAST "Cell Broadcast messages support" ON ON ON)
700 macro_gammu_option (BACKUP "Backup/Restore functions" ON ON ON)
702 # Generate Doxygen file
703 set (DOXYGEN_INPUT "${Gammu_BINARY_DIR}/include")
704 set (DOXYGEN_INTERNAL_INPUT "${Gammu_SOURCE_DIR}/libgammu")
705 set (DOXYGEN_OUTPUT "${Gammu_BINARY_DIR}/gammu-doc")
706 set (DOXYGEN_INTERNAL_OUTPUT "${Gammu_BINARY_DIR}/gammu-internal-doc")
707 if ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
708     set (HAVE_DOT "NO")
709     set (DOXYGEN_DOT_PATH "")
710 else ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
711     set (HAVE_DOT "YES")
712     # Strip binary name from variable
713     string (REGEX REPLACE "/dot$" "" DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}")
714 endif ("${DOXYGEN_DOT_EXECUTABLE}" STREQUAL DOXYGEN_DOT_EXECUTABLE-NOTFOUND)
715 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/Doxyfile.cmake" "${Gammu_BINARY_DIR}/doxygen/Doxyfile")
716 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/Doxyfile-internal.cmake" "${Gammu_BINARY_DIR}/doxygen/Doxyfile-internal")
717 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/api.desc.cmake" "${Gammu_BINARY_DIR}/doxygen/api.desc")
718 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/internals.desc.cmake" "${Gammu_BINARY_DIR}/doxygen/internals.desc")
720 # Target for generating API documentation
721 add_custom_target (apidoc ${DOXYGEN_EXECUTABLE} doxygen/Doxyfile
722     COMMAND find ${DOXYGEN_OUTPUT}/html -name '*.html' -print0 | xargs -0 sed -i 's@text/html\;charset=iso-8859-1@text/html\;charset=utf-8@'
723     COMMENT "Generating API documentation")
725 add_custom_target (interndoc ${DOXYGEN_EXECUTABLE} doxygen/Doxyfile-internal
726     COMMAND find ${DOXYGEN_INTERNAL_OUTPUT}/html -name '*.html' -print0 | xargs -0 sed -i 's@text/html\;charset=iso-8859-1@text/html\;charset=utf-8@'
727     COMMENT "Generating internal documentation")
729 # CPP check
730 find_program(CPPCHECK_EXECUTABLE NAMES cppcheck
731     DOC "cppcheck - code checking tool")
732 add_custom_target (cppcheck ${CPPCHECK_EXECUTABLE} -a -f -q "${Gammu_SOURCE_DIR}/gammu" "${Gammu_SOURCE_DIR}/smsd" "${Gammu_SOURCE_DIR}/helper" "${Gammu_SOURCE_DIR}/libgammu" "${Gammu_SOURCE_DIR}/python/gammu/src" "${Gammu_SOURCE_DIR}/tests" "${Gammu_SOURCE_DIR}/docs/manual/examples" "${Gammu_SOURCE_DIR}/contrib/smscgi"
733     COMMENT "Checking C code")
736 # Generate pkgconfig file
737 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/gammu.pc.cmake" "${Gammu_BINARY_DIR}/cfg/gammu.pc" @ONLY)
738 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/gammu-smsd.pc.cmake" "${Gammu_BINARY_DIR}/cfg/gammu-smsd.pc" @ONLY)
739 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/gammu-uninstalled.pc.cmake" "${Gammu_BINARY_DIR}/pkgconfig/gammu.pc" @ONLY)
740 configure_file ("${Gammu_SOURCE_DIR}/cmake/templates/gammu-smsd-uninstalled.pc.cmake" "${Gammu_BINARY_DIR}/pkgconfig/gammu-smsd.pc" @ONLY)
742 # Install instructions
744 # Install Windows libraries
745 if (WIN32 AND NOT CYGWIN)
746     # MySQL
747     if (MYSQL_FOUND)
748         foreach(lib ${WIN_LIB_MYSQL})
749             ADD_DLL("${lib}" "${MYSQL_LIBRARIES}")
750         endforeach(lib ${WIN_LIB_MYSQL})
751     endif (MYSQL_FOUND)
753     # PostgreSQL and dependencies
754     if (POSTGRES_FOUND)
755         foreach(lib ${WIN_LIB_PGSQL})
756             ADD_DLL("${lib}" "${POSTGRES_LIBRARY}")
757         endforeach(lib ${WIN_LIB_PGSQL})
758     endif (POSTGRES_FOUND)
760     # iconv and dependencies
761     if (ICONV_FOUND)
762         foreach(lib ${WIN_LIB_ICONV})
763             ADD_DLL("${lib}" "${ICONV_LIBRARIES}")
764         endforeach(lib ${WIN_LIB_ICONV})
765     endif (ICONV_FOUND)
767     # Gettext and dependencies
768     if (LIBINTL_LIB_FOUND)
769         foreach(lib ${WIN_LIB_INTL})
770             ADD_DLL("${lib}" "${LIBINTL_LIBRARY}")
771         endforeach(lib ${WIN_LIB_INTL})
772     endif (LIBINTL_LIB_FOUND)
774     # Curl and dependencies
775     if (CURL_FOUND)
776         foreach(lib ${WIN_LIB_CURL})
777             ADD_DLL("${lib}" "${CURL_LIBRARIES}")
778         endforeach(lib ${WIN_LIB_CURL})
779     endif (CURL_FOUND)
781     # Glib and dependencies
782     if (GLIB_FOUND)
783         foreach(lib ${WIN_LIB_GLIB})
784             ADD_DLL("${lib}" "${GLIB_LIBRARIES}")
785         endforeach(lib ${WIN_LIB_GLIB})
786     endif (GLIB_FOUND)
788     install (FILES ${WIN32_INSTALL_DLL}
789             DESTINATION "${INSTALL_BIN_DIR}"
790             COMPONENT dlls
791             )
792 endif (WIN32 AND NOT CYGWIN)
794 install (
795     FILES "${Gammu_BINARY_DIR}/cfg/gammu.pc" "${Gammu_BINARY_DIR}/cfg/gammu-smsd.pc"
796     DESTINATION "${INSTALL_LIBDATA_DIR}/pkgconfig"
797     COMPONENT "pkgconfig"
798     )
800 # We want some tests. Even when cross compiling for Windows tests can be
801 # done in Wine. This is better than nothing, even though Wine is a bit
802 # more fault tolerant when linking DLLs.
804 # Valgrind supressions for python
805 set (MEMORYCHECK_SUPPRESSIONS_FILE ${Gammu_SOURCE_DIR}/cmake/valgrind-python.supp CACHE FILEPATH "File that contains suppressions for the memory checker")
807 # Testing and dashboard
808 include(CTest)
809 enable_testing()
810 include(Dart)
812 # Packaging support
813 set (CPACK_PACKAGE_NAME "Gammu")
814 set (CPACK_PACKAGE_VERSION "${GAMMU_VERSION}")
815 set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gammu All Mobile Management Utilities ${GAMMU_VERSION}")
816 set (CPACK_PACKAGE_VENDOR "Michal Čihař")
817 set (CPACK_PACKAGE_CONTACT "Michal Čihař <michal@cihar.com>")
818 set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/installer/description.txt")
819 # On Mac OS, the file needs .txt extension, give it to them
820 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/README" "${CMAKE_CURRENT_BINARY_DIR}/readme.txt" COPYONLY)
821 set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}/readme.txt")
822 set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/installer/license.txt")
823 set (CPACK_PACKAGE_VERSION_MAJOR "${GAMMU_VERSION_MAJOR}")
824 set (CPACK_PACKAGE_VERSION_MINOR "${GAMMU_VERSION_MINOR}")
825 set (CPACK_PACKAGE_VERSION_PATCH "${GAMMU_VERSION_PATCH}")
826 set (CPACK_INSTALLER_PROGRAM_DISK_IMAGE "${Gammu_SOURCE_DIR}/installer/addpostflight")
828 if (WIN32 AND NOT CYGWIN)
829     set (CPACK_SYSTEM_NAME "Windows" CACHE STRING "Windows package name")
830 endif (WIN32 AND NOT CYGWIN)
832 # RPM
833 set (CPACK_RPM_PACKAGE_LICENSE "GPLv2")
834 if (EXISTS "/etc/SuSE-release")
835 set (CPACK_RPM_PACKAGE_GROUP "Hardware/Mobile")
836 else (EXISTS "/etc/SuSE-release")
837 set (CPACK_RPM_PACKAGE_GROUP "Applications/Communications")
838 endif (EXISTS "/etc/SuSE-release")
840 # Components
841 set (CPACK_COMPONENTS_ALL gammu library smsd headers utils manpages docs pkgconfig gnapplet examples manual)
842 if (WITH_PYTHON)
843     list (APPEND CPACK_COMPONENTS_ALL python)
844 endif (WITH_PYTHON)
845 if (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
846     list (APPEND CPACK_COMPONENTS_ALL dlls)
847 endif (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
849 set (CPACK_COMPONENT_GAMMU_DISPLAY_NAME "Gammu Application")
850 set (CPACK_COMPONENT_SMSD_DISPLAY_NAME "Gammu SMS Daemon")
851 set (CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Gammu Library")
852 set (CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C Headers")
853 set (CPACK_COMPONENT_UTILS_DISPLAY_NAME "Utility Scripts")
854 set (CPACK_COMPONENT_MANPAGES_DISPLAY_NAME "Manual Pages")
855 set (CPACK_COMPONENT_DOCS_DISPLAY_NAME "User Documentation")
856 set (CPACK_COMPONENT_PKGCONFIG_DISPLAY_NAME "Pkg-config Data")
857 set (CPACK_COMPONENT_GNAPPLET_DISPLAY_NAME "Applet for Symbian Phones")
858 set (CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples Using Gammu")
859 set (CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Gammu Manual")
860 set (CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python Module")
861 set (CPACK_COMPONENT_MEDIA_DISPLAY_NAME "Media Files")
863 set (CPACK_COMPONENT_DLLS_HIDDEN TRUE)
864 set (CPACK_COMPONENT_DLLS_REQUIRED TRUE)
865 set (CPACK_COMPONENT_LIBRARY_REQUIRED TRUE)
867 set (CPACK_COMPONENT_GAMMU_DESCRIPTION "The gammu.exe program.")
868 set (CPACK_COMPONENT_SMSD_DESCRIPTION "Gammu SMS Daemon which automatically sends and receives messages.")
869 set (CPACK_COMPONENT_LIBRARY_DESCRIPTION "Gammu library.")
870 set (CPACK_COMPONENT_HEADERS_DESCRIPTION "C headers for development own programs using Gammu library.")
871 set (CPACK_COMPONENT_UTILS_DESCRIPTION "Utility scripts, mostly written using bourne shell, which you need to install on your own.")
872 set (CPACK_COMPONENT_MANPAGES_DESCRIPTION "Manual pages for programs and configuration files.")
873 set (CPACK_COMPONENT_DOCS_DESCRIPTION "User documentation in text files.")
874 set (CPACK_COMPONENT_PKGCONFIG_DESCRIPTION "Data for pkg-config program (automatic finding of compiler parameters for libraries).")
875 set (CPACK_COMPONENT_GNAPPLET_DESCRIPTION "Applet for Symbian phones, install it to phone to communicate with them using Gammu.")
876 set (CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Examples showing how to use Gammu, in PHP, Perl or C.")
877 set (CPACK_COMPONENT_MANUAL_DESCRIPTION "User and Developer Manual")
878 set (CPACK_COMPONENT_PYTHON_DESCRIPTION "Python module for Gammu.")
879 set (CPACK_COMPONENT_MEDIA_DESCRIPTION "Various media files which can be used with Gammu.")
881 set (CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Programs and libraries for general usage.")
882 set (CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Headers and documentation used for development using Gammu.")
883 set (CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION "Gammu documentation and usage examples.")
885 set(CPACK_COMPONENT_GAMMU_DEPENDS library)
886 if (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
887 set(CPACK_COMPONENT_LIBRARY_DEPENDS dlls)
888 endif (WIN32 AND NOT CYGWIN AND WIN32_INSTALL_DLL)
889 set(CPACK_COMPONENT_SMSD_DEPENDS library)
890 set(CPACK_COMPONENT_HEADERS_DEPENDS library)
891 set(CPACK_COMPONENT_PYTHON_DEPENDS library)
892 set(CPACK_COMPONENT_UTILS_DEPENDS gammu)
893 set(CPACK_COMPONENT_PKGCONFIG_DEPENDS headers)
895 set (CPACK_COMPONENT_GAMMU_GROUP "Runtime")
896 set (CPACK_COMPONENT_SMSD_GROUP "Runtime")
897 set (CPACK_COMPONENT_UTILS_GROUP "Runtime")
898 set (CPACK_COMPONENT_LIBRARY_GROUP "Runtime")
899 set (CPACK_COMPONENT_PYTHON_GROUP "Runtime")
901 set (CPACK_COMPONENT_HEADERS_GROUP "Development")
902 set (CPACK_COMPONENT_PKGCONFIG_GROUP "Development")
904 set (CPACK_COMPONENT_MANPAGES_GROUP "Documentation")
905 set (CPACK_COMPONENT_DOCS_GROUP "Documentation")
906 set (CPACK_COMPONENT_EXAMPLES_GROUP "Documentation")
907 set (CPACK_COMPONENT_MANUAL_GROUP "Documentation")
908 set (CPACK_COMPONENT_MEDIA_GROUP "Documentation")
910 set (CPACK_ALL_INSTALL_TYPES Standard Developer Full)
912 set (CPACK_COMPONENT_GAMMU_INSTALL_TYPES Standard Developer Full)
913 set (CPACK_COMPONENT_SMSD_INSTALL_TYPES Standard Developer Full)
914 set (CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Standard Developer Full)
915 set (CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
916 set (CPACK_COMPONENT_UTILS_INSTALL_TYPES Full)
917 set (CPACK_COMPONENT_MANPAGES_INSTALL_TYPES Standard Developer Full)
918 set (CPACK_COMPONENT_DOCS_INSTALL_TYPES Standard Developer Full)
919 set (CPACK_COMPONENT_PKGCONFIG_INSTALL_TYPES Developer Full)
920 set (CPACK_COMPONENT_GNAPPLET_INSTALL_TYPES Standard Developer Full)
921 set (CPACK_COMPONENT_EXAMPLES_INSTALL_TYPES Developer Full)
922 set (CPACK_COMPONENT_MANUAL_INSTALL_TYPES Developer Full)
923 set (CPACK_COMPONENT_PYTHON_INSTALL_TYPES Developer Full)
924 set (CPACK_COMPONENT_MEDIA_INSTALL_TYPES Full)
926 if (WIN32 AND NOT CYGWIN)
927   set (CPACK_PACKAGE_INSTALL_DIRECTORY "Gammu ${GAMMU_VERSION}")
928   set (CPACK_NSIS_DISPLAY_NAME "Gammu ${GAMMU_VERSION}")
929   set (CPACK_NSIS_HELP_LINK "http://wammu.eu/support/")
930   set (CPACK_NSIS_URL_INFO_ABOUT "http://wammu.eu/gammu/")
931   set (CPACK_NSIS_CONTACT "michal@cihar.com")
932   set (CPACK_NSIS_MODIFY_PATH ON)
933 else (WIN32 AND NOT CYGWIN)
934   set (CPACK_STRIP_FILES "gammu")
935   set (CPACK_SOURCE_STRIP_FILES "")
936 endif (WIN32 AND NOT CYGWIN)
937 include (CPack)
939 # Test files for Gammu
940 set (RINGTONE_TEST_FILE ${Gammu_SOURCE_DIR}/contrib/media/axelf.txt)
941 set (LOGO_TEST_FILE ${Gammu_SOURCE_DIR}/contrib/media/aliens.nlm)
943 # Transverse to dirs
944 add_subdirectory(include)
946 add_subdirectory(libgammu)
948 add_subdirectory(helper)
950 add_subdirectory(tests)
952 add_subdirectory(smsd)
954 add_subdirectory(gammu)
956 add_subdirectory(gammu-detect)
958 add_subdirectory(locale)
960 add_subdirectory(utils)
962 option(INSTALL_DOC "Install documentation" ON)
964 if(INSTALL_DOC)
965     install (
966         FILES ${DOCS}
967         DESTINATION "${INSTALL_DOC_DIR}"
968         COMPONENT "docs"
969         )
971     add_subdirectory(docs/config)
972     add_subdirectory(docs/manual)
973     add_subdirectory(docs/examples)
974     add_subdirectory(docs/sql)
975     add_subdirectory(docs/user)
976 endif(INSTALL_DOC)
978 add_subdirectory(contrib)
980 if (WITH_PYTHON)
981     add_subdirectory(python)
982 else (WITH_PYTHON)
983     message ("Python bindings are disabled!")
984 endif (WITH_PYTHON)