1 # cmake <http://www.cmake.org> build file for Gammu
2 # Copyright © 2007 - 2009 Michal Čihař
3 # vim: expandtab sw=4 ts=4 sts=4:
7 include(GammuTuneCompiler)
20 service/sms/gsmmulti.c
28 service/backup/gsmback.c
29 service/backup/backldif.c
30 service/backup/backlmb.c
31 service/backup/backtext.c
32 service/backup/backvcs.c
33 service/backup/backvcf.c
34 service/backup/backics.c
35 service/backup/backvnt.c
36 device/bluetoth/bluetoth.c
41 protocol/alcatel/alcabus.c
42 protocol/nokia/mbus2.c
43 protocol/nokia/fbus2.c
44 protocol/nokia/phonet.c
46 protocol/symbian/gnapbus.c
54 phone/at/sonyericsson.c
55 phone/alcatel/alcatel.c
57 phone/nokia/dct3/n0650.c
58 phone/nokia/dct3/n6110.c
59 phone/nokia/dct3/n7110.c
60 phone/nokia/dct3/n9210.c
61 phone/nokia/dct3/dct3func.c
62 phone/nokia/dct4s40/n3320.c
63 phone/nokia/dct4s40/dct4func.c
64 phone/nokia/dct4s40/6510/n6510.c
65 phone/nokia/dct4s40/6510/6510cal.c
66 phone/nokia/dct4s40/6510/6510file.c
67 phone/nokia/wd2/n3650.c
70 phone/nokia/nfuncold.c
73 phone/symbian/gnapgen.c
76 # Own or glib based MD5 implementation
78 list (APPEND LIBRARY_SRC misc/coding/md5-glib.c)
80 list (APPEND LIBRARY_SRC misc/coding/md5.c)
84 list (APPEND LIBRARY_SRC phone/dummy/dummy.c)
87 list (APPEND LIBRARY_SRC device/bluetoth/bluez.c)
90 list (APPEND LIBRARY_SRC device/bluetoth/blue_bsd.c)
91 endif (BSD_BLUE_FOUND)
93 list (APPEND LIBRARY_SRC device/bluetoth/blue_osx.c)
94 endif (OSX_BLUE_FOUND)
95 if (WIN32 AND NOT CYGWIN)
96 list (APPEND LIBRARY_SRC device/bluetoth/blue_w32.c)
97 endif (WIN32 AND NOT CYGWIN)
99 if (CYGWIN OR NOT WIN32 AND NOT DJGPP)
100 list (APPEND LIBRARY_SRC device/serial/ser_unx.c)
101 endif (CYGWIN OR NOT WIN32 AND NOT DJGPP)
103 list (APPEND LIBRARY_SRC device/serial/ser_djg.c)
105 if (WIN32 AND NOT CYGWIN)
106 list (APPEND LIBRARY_SRC device/serial/ser_w32.c)
107 endif (WIN32 AND NOT CYGWIN)
110 add_library (libGammu ${LIBRARY_SRC})
111 set_target_properties (libGammu PROPERTIES
112 VERSION ${GAMMU_SOVERSION}.${GAMMU_VERSION}
113 SOVERSION ${GAMMU_SOVERSION}
115 if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN)
116 set_target_properties (libGammu PROPERTIES COMPILE_FLAGS -fPIC)
117 endif (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN)
118 if(CMAKE_COMPILER_IS_MINGW AND BUILD_SHARED_LIBS)
119 SET_TARGET_PROPERTIES(libGammu PROPERTIES LINK_FLAGS
120 "-Wl,--output-def,${CMAKE_CURRENT_BINARY_DIR}/libGammu.def")
121 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libGammu.def
122 DESTINATION "${INSTALL_LIB_DIR}"
124 endif(CMAKE_COMPILER_IS_MINGW AND BUILD_SHARED_LIBS)
127 target_link_libraries (libGammu string)
130 target_link_libraries (libGammu ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES})
131 include_directories(${GLIB_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS})
135 target_link_libraries (libGammu ${BLUEZ_LIBRARIES})
136 include_directories (${BLUEZ_INCLUDE_DIR})
140 target_link_libraries (libGammu ${LIBUSB_LIBRARIES})
141 include_directories (${LIBUSB_INCLUDE_DIR})
145 target_link_libraries (libGammu ${BSD_BLUE_LIBRARIES})
146 include_directories (${BSD_BLUE_INCLUDE_DIR})
147 endif (BSD_BLUE_FOUND)
150 target_link_libraries (libGammu ${OSX_BLUE_LIBS})
151 include_directories (${OSX_BLUE_INCLUDE_DIR})
152 endif (OSX_BLUE_FOUND)
155 target_link_libraries (libGammu ${ICONV_LIBRARIES})
156 include_directories (${ICONV_INCLUDE_DIR})
160 target_link_libraries (libGammu ${MATH_LIBRARIES})
163 if (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
164 target_link_libraries (libGammu ${LIBINTL_LIBRARIES})
165 include_directories (${LIBINTL_INCLUDE_DIR})
166 endif (LIBINTL_LIB_FOUND AND LIBINTL_LIBRARIES)
168 # dirent emulation layer
169 if(WIN32 AND NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN)
170 target_link_libraries (libGammu win32dirent)
171 endif(WIN32 AND NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN)
173 # Include search path
174 include_directories ("${CMAKE_CURRENT_BINARY_DIR}/../include")
175 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../common")
177 # Add libraries needed for windows build
178 if (WIN32 AND NOT CYGWIN)
179 # Magic needed for SHGetFolderPathA
180 target_link_libraries (libGammu shfolder shell32)
182 target_link_libraries (libGammu ws2_32)
183 # These libraries are needed for serial driver
184 target_link_libraries (libGammu setupapi advapi32)
185 endif (WIN32 AND NOT CYGWIN)
187 # Install instructions
188 install (TARGETS libGammu
189 RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
191 LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
193 ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"