|
ferencd@0
|
1 #
|
|
ferencd@0
|
2 # CMake configuration file for VMime
|
|
ferencd@0
|
3 #
|
|
ferencd@0
|
4 # Usage:
|
|
ferencd@0
|
5 #
|
|
ferencd@0
|
6 # . 'cmake -LH' to list build settings variable
|
|
ferencd@0
|
7 #
|
|
ferencd@0
|
8 # . 'cmake -G <generator>' to generate makefiles for a build system
|
|
ferencd@0
|
9 # eg. cmake -G "Unix Makefiles"
|
|
ferencd@0
|
10 #
|
|
ferencd@0
|
11 # For more information, please visit:
|
|
ferencd@0
|
12 # http://www.cmake.org
|
|
ferencd@0
|
13 #
|
|
ferencd@0
|
14
|
|
ferencd@0
|
15 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR)
|
|
ferencd@0
|
16
|
|
ferencd@0
|
17 INCLUDE(cmake/Utils.cmake)
|
|
ferencd@0
|
18
|
|
ferencd@0
|
19 INCLUDE(CheckIncludeFiles)
|
|
ferencd@0
|
20 INCLUDE(CheckIncludeFileCXX)
|
|
ferencd@0
|
21 INCLUDE(CheckFunctionExists)
|
|
ferencd@0
|
22 INCLUDE(CheckSymbolExists)
|
|
ferencd@0
|
23 INCLUDE(CheckTypeSize)
|
|
ferencd@0
|
24 INCLUDE(CheckLibraryExists)
|
|
ferencd@0
|
25 INCLUDE(CheckCXXSourceCompiles)
|
|
ferencd@0
|
26
|
|
ferencd@0
|
27
|
|
ferencd@0
|
28 # CMake configuration
|
|
ferencd@0
|
29 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY build/bin)
|
|
ferencd@0
|
30 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY build/lib)
|
|
ferencd@0
|
31 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build/lib)
|
|
ferencd@0
|
32
|
|
ferencd@0
|
33 SET(CMAKE_VERBOSE_MAKEFILE ON)
|
|
ferencd@0
|
34
|
|
ferencd@0
|
35
|
|
ferencd@0
|
36 # Project
|
|
ferencd@0
|
37 PROJECT(vmime)
|
|
ferencd@0
|
38
|
|
ferencd@0
|
39 # Package version number
|
|
ferencd@0
|
40 SET(VMIME_VERSION_MAJOR 0)
|
|
ferencd@0
|
41 SET(VMIME_VERSION_MINOR 9)
|
|
ferencd@0
|
42 SET(VMIME_VERSION_MICRO 2)
|
|
ferencd@0
|
43
|
|
ferencd@0
|
44 # API version number (libtool)
|
|
ferencd@0
|
45 #
|
|
ferencd@0
|
46 # Increment this number only immediately before a public release.
|
|
ferencd@0
|
47 # This is independent from package version number.
|
|
ferencd@0
|
48 #
|
|
ferencd@0
|
49 # See: http://www.gnu.org/software/libtool/manual.html#Libtool-versioning
|
|
ferencd@0
|
50 #
|
|
ferencd@0
|
51 # . Implementation changed (eg. bug/security fix): REVISION++
|
|
ferencd@0
|
52 # . Interfaces added/removed/changed: CURRENT++, REVISION=0
|
|
ferencd@0
|
53 # . Interfaces added (upward-compatible changes): AGE++
|
|
ferencd@0
|
54 # . Interfaces removed: AGE=0
|
|
ferencd@0
|
55 SET(VMIME_API_VERSION_CURRENT 0)
|
|
ferencd@0
|
56 SET(VMIME_API_VERSION_REVISION 0)
|
|
ferencd@0
|
57 SET(VMIME_API_VERSION_AGE 0)
|
|
ferencd@0
|
58
|
|
ferencd@0
|
59
|
|
ferencd@0
|
60 SET(VMIME_VERSION ${VMIME_VERSION_MAJOR}.${VMIME_VERSION_MINOR}.${VMIME_VERSION_MICRO})
|
|
ferencd@0
|
61 SET(VMIME_API_VERSION ${VMIME_API_VERSION_CURRENT}.${VMIME_API_VERSION_REVISION}.${VMIME_API_VERSION_AGE})
|
|
ferencd@0
|
62
|
|
ferencd@0
|
63
|
|
ferencd@0
|
64 ##############################################################################
|
|
ferencd@0
|
65 # VMime Library
|
|
ferencd@0
|
66
|
|
ferencd@0
|
67 # Set base name
|
|
ferencd@0
|
68 SET(VMIME_LIBRARY_NAME vmime)
|
|
ferencd@0
|
69
|
|
ferencd@0
|
70 # Source files
|
|
ferencd@0
|
71 FILE(
|
|
ferencd@0
|
72 GLOB_RECURSE
|
|
ferencd@0
|
73 VMIME_LIBRARY_SRC_FILES
|
|
ferencd@0
|
74 ${CMAKE_CURRENT_SOURCE_DIR}/src/vmime/*.cpp
|
|
ferencd@0
|
75 )
|
|
ferencd@0
|
76
|
|
ferencd@0
|
77 FILE(
|
|
ferencd@0
|
78 GLOB_RECURSE
|
|
ferencd@0
|
79 VMIME_LIBRARY_INCLUDE_FILES
|
|
ferencd@0
|
80 ${CMAKE_CURRENT_SOURCE_DIR}/src/vmime/*.hpp
|
|
ferencd@0
|
81 )
|
|
ferencd@0
|
82
|
|
ferencd@0
|
83 LIST(APPEND VMIME_LIBRARY_GENERATED_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/vmime/config.hpp")
|
|
ferencd@0
|
84
|
|
ferencd@0
|
85 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
86 ${CMAKE_CURRENT_SOURCE_DIR} # for "contrib/"
|
|
ferencd@0
|
87 ${CMAKE_CURRENT_SOURCE_DIR}/src # for "vmime/
|
|
ferencd@0
|
88 )
|
|
ferencd@0
|
89
|
|
ferencd@0
|
90 INCLUDE(GenerateExportHeader)
|
|
ferencd@0
|
91 ADD_COMPILER_EXPORT_FLAGS()
|
|
ferencd@0
|
92
|
|
ferencd@0
|
93 # Shared library
|
|
ferencd@0
|
94 OPTION(
|
|
ferencd@0
|
95 VMIME_BUILD_SHARED_LIBRARY
|
|
ferencd@0
|
96 "Build shared library"
|
|
ferencd@0
|
97 ON
|
|
ferencd@0
|
98 )
|
|
ferencd@0
|
99
|
|
ferencd@0
|
100 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
101
|
|
ferencd@0
|
102 ADD_LIBRARY(
|
|
ferencd@0
|
103 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
104 SHARED
|
|
ferencd@0
|
105 ${VMIME_LIBRARY_SRC_FILES}
|
|
ferencd@0
|
106 ${VMIME_LIBRARY_INCLUDE_FILES}
|
|
ferencd@0
|
107 )
|
|
ferencd@0
|
108
|
|
ferencd@0
|
109 GENERATE_EXPORT_HEADER(
|
|
ferencd@0
|
110 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
111 BASE_NAME VMIME
|
|
ferencd@0
|
112 STATIC_DEFINE VMIME_STATIC
|
|
ferencd@0
|
113 EXPORT_FILE_NAME export-shared.hpp
|
|
ferencd@0
|
114 )
|
|
ferencd@0
|
115
|
|
ferencd@0
|
116 FILE(
|
|
ferencd@0
|
117 COPY
|
|
ferencd@0
|
118 ${CMAKE_CURRENT_BINARY_DIR}/export-shared.hpp
|
|
ferencd@0
|
119 DESTINATION
|
|
ferencd@0
|
120 ${PROJECT_SOURCE_DIR}/src/vmime
|
|
ferencd@0
|
121 )
|
|
ferencd@0
|
122
|
|
ferencd@0
|
123 LIST(APPEND VMIME_LIBRARY_GENERATED_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/vmime/export-shared.hpp")
|
|
ferencd@0
|
124
|
|
ferencd@0
|
125 SET_TARGET_PROPERTIES(
|
|
ferencd@0
|
126 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
127 PROPERTIES
|
|
ferencd@0
|
128 VERSION "${VMIME_API_VERSION}"
|
|
ferencd@0
|
129 SOVERSION "${VMIME_API_VERSION_CURRENT}"
|
|
ferencd@0
|
130 COMPILE_FLAGS -DVMIME_SHARED
|
|
ferencd@0
|
131 )
|
|
ferencd@0
|
132
|
|
ferencd@0
|
133 ENDIF()
|
|
ferencd@0
|
134
|
|
ferencd@0
|
135 # Static library
|
|
ferencd@0
|
136 #
|
|
ferencd@0
|
137 # Note: cannot have two targets with the same name so the static version has
|
|
ferencd@0
|
138 # '-static' appended and then the name of the output file is set separately.
|
|
ferencd@0
|
139 OPTION(
|
|
ferencd@0
|
140 VMIME_BUILD_STATIC_LIBRARY
|
|
ferencd@0
|
141 "Build static library"
|
|
ferencd@0
|
142 ON
|
|
ferencd@0
|
143 )
|
|
ferencd@0
|
144
|
|
ferencd@0
|
145 IF(VMIME_BUILD_STATIC_LIBRARY)
|
|
ferencd@0
|
146
|
|
ferencd@0
|
147 ADD_LIBRARY(
|
|
ferencd@0
|
148 ${VMIME_LIBRARY_NAME}-static
|
|
ferencd@0
|
149 STATIC
|
|
ferencd@0
|
150 ${VMIME_LIBRARY_SRC_FILES}
|
|
ferencd@0
|
151 ${VMIME_LIBRARY_INCLUDE_FILES}
|
|
ferencd@0
|
152 )
|
|
ferencd@0
|
153
|
|
ferencd@0
|
154 GENERATE_EXPORT_HEADER(
|
|
ferencd@0
|
155 ${VMIME_LIBRARY_NAME}-static
|
|
ferencd@0
|
156 BASE_NAME VMIME
|
|
ferencd@0
|
157 STATIC_DEFINE VMIME_STATIC
|
|
ferencd@0
|
158 EXPORT_FILE_NAME export-static.hpp
|
|
ferencd@0
|
159 )
|
|
ferencd@0
|
160
|
|
ferencd@0
|
161 FILE(
|
|
ferencd@0
|
162 COPY
|
|
ferencd@0
|
163 ${CMAKE_CURRENT_BINARY_DIR}/export-static.hpp
|
|
ferencd@0
|
164 DESTINATION
|
|
ferencd@0
|
165 ${PROJECT_SOURCE_DIR}/src/vmime
|
|
ferencd@0
|
166 )
|
|
ferencd@0
|
167
|
|
ferencd@0
|
168 LIST(APPEND VMIME_LIBRARY_GENERATED_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/vmime/export-static.hpp")
|
|
ferencd@0
|
169
|
|
ferencd@0
|
170 SET_TARGET_PROPERTIES(
|
|
ferencd@0
|
171 ${VMIME_LIBRARY_NAME}-static
|
|
ferencd@0
|
172 PROPERTIES
|
|
ferencd@0
|
173 OUTPUT_NAME ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
174 COMPILE_FLAGS -DVMIME_STATIC
|
|
ferencd@0
|
175 )
|
|
ferencd@0
|
176
|
|
ferencd@0
|
177 ENDIF()
|
|
ferencd@0
|
178
|
|
ferencd@0
|
179 # Ensure at least one type of library (either shared or static) is build
|
|
ferencd@0
|
180 IF(NOT(VMIME_BUILD_SHARED_LIBRARY OR VMIME_BUILD_STATIC_LIBRARY))
|
|
ferencd@0
|
181 MESSAGE(FATAL_ERROR "You should select at least one library to build (either VMIME_BUILD_SHARED_LIBRARY or VMIME_BUILD_STATIC_LIBRARY must be set to YES.")
|
|
ferencd@0
|
182 ENDIF()
|
|
ferencd@0
|
183
|
|
ferencd@0
|
184 # These next two lines are required but it is unclear exactly what they do.
|
|
ferencd@0
|
185 # The CMake FAQ mentions they are necessary and it does not work otherwise.
|
|
ferencd@0
|
186 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
187 SET_TARGET_PROPERTIES(${VMIME_LIBRARY_NAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
|
ferencd@0
|
188 ENDIF()
|
|
ferencd@0
|
189 IF(VMIME_BUILD_STATIC_LIBRARY)
|
|
ferencd@0
|
190 SET_TARGET_PROPERTIES(${VMIME_LIBRARY_NAME}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
|
ferencd@0
|
191 ENDIF()
|
|
ferencd@0
|
192
|
|
ferencd@0
|
193 SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
|
|
ferencd@0
|
194
|
|
ferencd@0
|
195 # Automatically set lib suffix
|
|
ferencd@0
|
196 IF(UNIX AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/debian_version")
|
|
ferencd@0
|
197 IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT LIB_SUFFIX)
|
|
ferencd@0
|
198 # ...only if LIB_SUFFIX is not defined...
|
|
ferencd@0
|
199 IF(NOT DEFINED LIB_SUFFIX)
|
|
ferencd@0
|
200 # ...and if CMAKE_INSTALL_LIBDIR does not already contain the suffix
|
|
ferencd@0
|
201 IF(NOT "${CMAKE_INSTALL_LIBDIR}" MATCHES ".*64.*")
|
|
ferencd@0
|
202 SET(LIB_SUFFIX 64)
|
|
ferencd@0
|
203 ENDIF()
|
|
ferencd@0
|
204 ENDIF()
|
|
ferencd@0
|
205 ENDIF()
|
|
ferencd@0
|
206 ENDIF()
|
|
ferencd@0
|
207
|
|
ferencd@0
|
208 # Determine library installation dir, in this order:
|
|
ferencd@0
|
209 # 1) use VMIME_INSTALL_LIBDIR if set
|
|
ferencd@0
|
210 # 2) use LIB_INSTALL_DIR if defined
|
|
ferencd@0
|
211 # 3) use CMAKE_INSTALL_LIBDIR if set
|
|
ferencd@0
|
212 # if it is a relative path, prepend CMAKE_INSTALL_PREFIX to it
|
|
ferencd@0
|
213 # 4) use CMAKE_INSTALL_PREFIX/lib
|
|
ferencd@0
|
214 IF(NOT DEFINED VMIME_INSTALL_LIBDIR)
|
|
ferencd@0
|
215 IF(DEFINED LIB_INSTALL_DIR)
|
|
ferencd@0
|
216 SET(VMIME_INSTALL_LIBDIR ${LIB_INSTALL_DIR})
|
|
ferencd@0
|
217 # respect CMAKE_INSTALL_LIBDIR if set
|
|
ferencd@0
|
218 ELSEIF(DEFINED CMAKE_INSTALL_LIBDIR)
|
|
ferencd@0
|
219 SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
|
ferencd@0
|
220 IF(IS_ABSOLUTE ${VMIME_INSTALL_LIBDIR})
|
|
ferencd@0
|
221 SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
|
|
ferencd@0
|
222 ELSE()
|
|
ferencd@0
|
223 SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
|
|
ferencd@0
|
224 ENDIF()
|
|
ferencd@0
|
225 ELSE()
|
|
ferencd@0
|
226 SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
|
|
ferencd@0
|
227 ENDIF()
|
|
ferencd@0
|
228 ENDIF()
|
|
ferencd@0
|
229
|
|
ferencd@0
|
230 # Installation of libraries
|
|
ferencd@0
|
231 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
232 INSTALL(
|
|
ferencd@0
|
233 TARGETS ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
234 LIBRARY DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT sharedlibs
|
|
ferencd@0
|
235 ARCHIVE DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT sharedlibs
|
|
ferencd@0
|
236 )
|
|
ferencd@0
|
237 ENDIF()
|
|
ferencd@0
|
238
|
|
ferencd@0
|
239 IF(VMIME_BUILD_STATIC_LIBRARY)
|
|
ferencd@0
|
240 INSTALL(
|
|
ferencd@0
|
241 TARGETS ${VMIME_LIBRARY_NAME}-static
|
|
ferencd@0
|
242 LIBRARY DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT staticlibs
|
|
ferencd@0
|
243 ARCHIVE DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT staticlibs
|
|
ferencd@0
|
244 )
|
|
ferencd@0
|
245 ENDIF()
|
|
ferencd@0
|
246
|
|
ferencd@0
|
247 # Installation of header files
|
|
ferencd@0
|
248 INSTALL_HEADERS_WITH_DIRECTORY(VMIME_LIBRARY_INCLUDE_FILES headers src/)
|
|
ferencd@0
|
249 INSTALL_HEADERS_WITH_DIRECTORY(VMIME_LIBRARY_GENERATED_INCLUDE_FILES headers src/)
|
|
ferencd@0
|
250
|
|
ferencd@0
|
251 #INSTALL(
|
|
ferencd@0
|
252 # FILES ${VMIME_LIBRARY_INCLUDE_FILES}
|
|
ferencd@0
|
253 # DESTINATION include
|
|
ferencd@0
|
254 # COMPONENT headers
|
|
ferencd@0
|
255 #)
|
|
ferencd@0
|
256
|
|
ferencd@0
|
257
|
|
ferencd@0
|
258 ##############################################################################
|
|
ferencd@0
|
259 # Tests
|
|
ferencd@0
|
260
|
|
ferencd@0
|
261 OPTION(
|
|
ferencd@0
|
262 VMIME_BUILD_TESTS
|
|
ferencd@0
|
263 "Build unit tests (this will create a 'run-tests' binary)"
|
|
ferencd@0
|
264 OFF
|
|
ferencd@0
|
265 )
|
|
ferencd@0
|
266
|
|
ferencd@0
|
267 IF(VMIME_BUILD_TESTS)
|
|
ferencd@0
|
268
|
|
ferencd@0
|
269 ENABLE_TESTING()
|
|
ferencd@0
|
270
|
|
ferencd@0
|
271 INCLUDE(cmake/FindCppUnit.cmake)
|
|
ferencd@0
|
272 INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR})
|
|
ferencd@0
|
273
|
|
ferencd@0
|
274 FILE(
|
|
ferencd@0
|
275 GLOB_RECURSE
|
|
ferencd@0
|
276 VMIME_TESTS_SRC_FILES
|
|
ferencd@0
|
277 ${CMAKE_SOURCE_DIR}/tests/*Test.cpp
|
|
ferencd@0
|
278 )
|
|
ferencd@0
|
279
|
|
ferencd@0
|
280 ADD_LIBRARY(
|
|
ferencd@0
|
281 test-runner
|
|
ferencd@0
|
282 ${CMAKE_SOURCE_DIR}/tests/testRunner.cpp ${CMAKE_SOURCE_DIR}/tests/testUtils.cpp
|
|
ferencd@0
|
283 )
|
|
ferencd@0
|
284
|
|
ferencd@0
|
285 # Build one file for each test
|
|
ferencd@0
|
286 FOREACH(VMIME_TEST_SRC_FILE ${VMIME_TESTS_SRC_FILES})
|
|
ferencd@0
|
287
|
|
ferencd@0
|
288 # "/path/to/vmime/tests/module/testFile.cpp" --> "module_testFile"
|
|
ferencd@0
|
289 GET_FILENAME_COMPONENT(VMIME_TEST_SRC_PATH "${VMIME_TEST_SRC_FILE}" PATH)
|
|
ferencd@0
|
290 STRING(REPLACE "${CMAKE_SOURCE_DIR}" "" VMIME_TEST_SRC_PATH "${VMIME_TEST_SRC_PATH}")
|
|
ferencd@0
|
291 GET_FILENAME_COMPONENT(VMIME_TEST_NAME "${VMIME_TEST_SRC_FILE}" NAME_WE)
|
|
ferencd@0
|
292 SET(VMIME_TEST_NAME "${VMIME_TEST_SRC_PATH}/${VMIME_TEST_NAME}")
|
|
ferencd@0
|
293 STRING(REPLACE "/" "_" VMIME_TEST_NAME "${VMIME_TEST_NAME}")
|
|
ferencd@0
|
294 STRING(REPLACE "_tests_" "" VMIME_TEST_NAME "${VMIME_TEST_NAME}")
|
|
ferencd@0
|
295
|
|
ferencd@0
|
296 ADD_EXECUTABLE(
|
|
ferencd@0
|
297 ${VMIME_TEST_NAME}
|
|
ferencd@0
|
298 ${VMIME_TEST_SRC_FILE}
|
|
ferencd@0
|
299 )
|
|
ferencd@0
|
300
|
|
ferencd@0
|
301 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
302 ${VMIME_TEST_NAME}
|
|
ferencd@0
|
303 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
304 ${CPPUNIT_LIBRARY} test-runner
|
|
ferencd@0
|
305 )
|
|
ferencd@0
|
306
|
|
ferencd@0
|
307 ADD_DEPENDENCIES(
|
|
ferencd@0
|
308 ${VMIME_TEST_NAME}
|
|
ferencd@0
|
309 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
310 )
|
|
ferencd@0
|
311
|
|
ferencd@0
|
312 ADD_TEST(
|
|
ferencd@0
|
313 ${VMIME_TEST_NAME}
|
|
ferencd@0
|
314 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${VMIME_TEST_NAME}
|
|
ferencd@0
|
315 )
|
|
ferencd@0
|
316
|
|
ferencd@0
|
317 ENDFOREACH()
|
|
ferencd@0
|
318
|
|
ferencd@0
|
319 # Build one file for all tests
|
|
ferencd@0
|
320 ADD_EXECUTABLE(
|
|
ferencd@0
|
321 "run-tests"
|
|
ferencd@0
|
322 ${VMIME_TESTS_SRC_FILES}
|
|
ferencd@0
|
323 )
|
|
ferencd@0
|
324
|
|
ferencd@0
|
325 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
326 "run-tests"
|
|
ferencd@0
|
327 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
328 ${CPPUNIT_LIBRARY} test-runner
|
|
ferencd@0
|
329 )
|
|
ferencd@0
|
330
|
|
ferencd@0
|
331 ADD_DEPENDENCIES(
|
|
ferencd@0
|
332 "run-tests"
|
|
ferencd@0
|
333 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
334 )
|
|
ferencd@0
|
335
|
|
ferencd@0
|
336 ENDIF()
|
|
ferencd@0
|
337
|
|
ferencd@0
|
338
|
|
ferencd@0
|
339 ##############################################################################
|
|
ferencd@0
|
340 # Examples
|
|
ferencd@0
|
341
|
|
ferencd@0
|
342 OPTION(
|
|
ferencd@0
|
343 VMIME_BUILD_SAMPLES
|
|
ferencd@0
|
344 "Build samples (in 'examples' directory)"
|
|
ferencd@0
|
345 ON
|
|
ferencd@0
|
346 )
|
|
ferencd@0
|
347
|
|
ferencd@0
|
348
|
|
ferencd@0
|
349 ##############################################################################
|
|
ferencd@0
|
350 # Packaging / Distribution
|
|
ferencd@0
|
351
|
|
ferencd@0
|
352 # Package information
|
|
ferencd@0
|
353 SET(VMIME_PACKAGE_NAME ${VMIME_LIBRARY_NAME})
|
|
ferencd@0
|
354 SET(VMIME_PACKAGE_VERSION ${VMIME_VERSION})
|
|
ferencd@0
|
355 SET(VMIME_PACKAGE_CONTACT "Vincent Richard <vincent@vmime.org>")
|
|
ferencd@0
|
356 SET(VMIME_PACKAGE_DESCRIPTION "VMime C++ Mail Library (http://www.vmime.org)")
|
|
ferencd@0
|
357
|
|
ferencd@0
|
358 SET(CPACK_PACKAGE_NAME "${VMIME_PACKAGE_NAME}")
|
|
ferencd@0
|
359 SET(CPACK_PACKAGE_CONTACT "${VMIME_PACKAGE_CONTACT}")
|
|
ferencd@0
|
360 SET(CPACK_PACKAGE_DESCRIPTION "${VMIME_PACKAGE_DESCRIPTION}")
|
|
ferencd@0
|
361 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_DESCRIPTION}")
|
|
ferencd@0
|
362 SET(CPACK_PACKAGE_VERSION "${VMIME_PACKAGE_VERSION}")
|
|
ferencd@0
|
363
|
|
ferencd@0
|
364 # Package settings
|
|
ferencd@0
|
365 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
|
|
ferencd@0
|
366
|
|
ferencd@0
|
367 IF(APPLE)
|
|
ferencd@0
|
368 # CPack/PackageManager won't allow file without recognized extension
|
|
ferencd@0
|
369 # to be used as license file.
|
|
ferencd@0
|
370 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/COPYING" "${CMAKE_BINARY_DIR}/COPYING.txt" COPYONLY)
|
|
ferencd@0
|
371 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.txt")
|
|
ferencd@0
|
372 ELSE()
|
|
ferencd@0
|
373 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
|
|
ferencd@0
|
374 ENDIF(APPLE)
|
|
ferencd@0
|
375
|
|
ferencd@0
|
376 SET(CPACK_SOURCE_GENERATOR TGZ)
|
|
ferencd@0
|
377 SET(CPACK_SOURCE_IGNORE_FILES "\\\\.git;~$;build/")
|
|
ferencd@0
|
378 SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
|
|
ferencd@0
|
379
|
|
ferencd@0
|
380 # Set components
|
|
ferencd@0
|
381 SET(CPACK_COMPONENTS_ALL sharedlibs staticlibs headers)
|
|
ferencd@0
|
382
|
|
ferencd@0
|
383 SET(CPACK_COMPONENT_SHAREDLIBS_DISPLAY_NAME "Shared libraries")
|
|
ferencd@0
|
384 SET(CPACK_COMPONENT_SHAREDLIBS_DESCRIPTION
|
|
ferencd@0
|
385 "Shared library for general use.")
|
|
ferencd@0
|
386
|
|
ferencd@0
|
387 SET(CPACK_COMPONENT_STATICLIBS_DISPLAY_NAME "Static libraries")
|
|
ferencd@0
|
388 SET(CPACK_COMPONENT_STATICLIBS_DESCRIPTION
|
|
ferencd@0
|
389 "Static library, good if you want to embed VMime in your application.")
|
|
ferencd@0
|
390
|
|
ferencd@0
|
391 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
|
|
ferencd@0
|
392 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
|
ferencd@0
|
393 "C/C++ header files.")
|
|
ferencd@0
|
394
|
|
ferencd@0
|
395 SET(CPACK_COMPONENT_SHAREDLIBS_GROUP "Development")
|
|
ferencd@0
|
396 SET(CPACK_COMPONENT_STATICLIBS_GROUP "Development")
|
|
ferencd@0
|
397 SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
|
ferencd@0
|
398 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "")
|
|
ferencd@0
|
399
|
|
ferencd@0
|
400 # Make a target "dist" to generate tarball
|
|
ferencd@0
|
401 SET(ARCHIVE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
|
|
ferencd@0
|
402
|
|
ferencd@0
|
403 ADD_CUSTOM_TARGET(
|
|
ferencd@0
|
404 dist
|
|
ferencd@0
|
405 COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
|
|
ferencd@0
|
406 | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
|
|
ferencd@0
|
407 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
ferencd@0
|
408 )
|
|
ferencd@0
|
409
|
|
ferencd@0
|
410 # PkgConfig
|
|
ferencd@0
|
411 SET(prefix ${CMAKE_INSTALL_PREFIX})
|
|
ferencd@0
|
412 SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
|
|
ferencd@0
|
413 SET(includedir ${CMAKE_INSTALL_PREFIX}/include/vmime)
|
|
ferencd@0
|
414 SET(libdir ${VMIME_INSTALL_LIBDIR})
|
|
ferencd@0
|
415
|
|
ferencd@0
|
416 SET(VMIME_PKGCONFIG_LIBS "")
|
|
ferencd@0
|
417 SET(VMIME_PKGCONFIG_CFLAGS "")
|
|
ferencd@0
|
418 SET(VMIME_PKGCONFIG_REQUIRES "")
|
|
ferencd@0
|
419
|
|
ferencd@0
|
420
|
|
ferencd@0
|
421 ##############################################################################
|
|
ferencd@0
|
422 # Build type
|
|
ferencd@0
|
423
|
|
ferencd@0
|
424 IF(NOT CMAKE_BUILD_TYPE)
|
|
ferencd@0
|
425 SET(
|
|
ferencd@0
|
426 CMAKE_BUILD_TYPE
|
|
ferencd@0
|
427 "Debug"
|
|
ferencd@0
|
428 CACHE STRING
|
|
ferencd@0
|
429 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
ferencd@0
|
430 FORCE
|
|
ferencd@0
|
431 )
|
|
ferencd@0
|
432 ENDIF(NOT CMAKE_BUILD_TYPE)
|
|
ferencd@0
|
433
|
|
ferencd@0
|
434 # Set a default build type for single-configuration
|
|
ferencd@0
|
435 # CMake generators if no build type is set.
|
|
ferencd@0
|
436 IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
|
ferencd@0
|
437 SET(CMAKE_BUILD_TYPE Debug)
|
|
ferencd@0
|
438 ENDIF()
|
|
ferencd@0
|
439
|
|
ferencd@0
|
440 # Debug build
|
|
ferencd@0
|
441 MESSAGE("-- Build type: ${CMAKE_BUILD_TYPE}")
|
|
ferencd@0
|
442 IF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
|
|
ferencd@0
|
443 ADD_DEFINITIONS(-DDEBUG)
|
|
ferencd@0
|
444 ENDIF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
|
|
ferencd@0
|
445
|
|
ferencd@0
|
446
|
|
ferencd@0
|
447 IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
ferencd@0
|
448 SET(VMIME_DEBUG 1)
|
|
ferencd@0
|
449 ELSE()
|
|
ferencd@0
|
450 SET(VMIME_DEBUG 0)
|
|
ferencd@0
|
451 ENDIF()
|
|
ferencd@0
|
452
|
|
ferencd@0
|
453
|
|
ferencd@0
|
454 ##############################################################################
|
|
ferencd@0
|
455 # Test endianness and basic type sizes
|
|
ferencd@0
|
456
|
|
ferencd@0
|
457 INCLUDE(TestBigEndian)
|
|
ferencd@0
|
458 TEST_BIG_ENDIAN(BIGENDIAN)
|
|
ferencd@0
|
459
|
|
ferencd@0
|
460 IF(BIGENDIAN EQUAL 0)
|
|
ferencd@0
|
461 set(VMIME_BYTE_ORDER_BIG_ENDIAN 0)
|
|
ferencd@0
|
462 set(VMIME_BYTE_ORDER_LITTLE_ENDIAN 1)
|
|
ferencd@0
|
463 ELSE(BIGENDIAN EQUAL 0)
|
|
ferencd@0
|
464 SET(VMIME_BYTE_ORDER_BIG_ENDIAN 1)
|
|
ferencd@0
|
465 SET(VMIME_BYTE_ORDER_LITTLE_ENDIAN 0)
|
|
ferencd@0
|
466 ENDIF(BIGENDIAN EQUAL 0)
|
|
ferencd@0
|
467
|
|
ferencd@0
|
468
|
|
ferencd@0
|
469 CHECK_INCLUDE_FILE_CXX(cstdint VMIME_HAVE_CSTDINT)
|
|
ferencd@0
|
470
|
|
ferencd@0
|
471 CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
|
|
ferencd@0
|
472 CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
|
|
ferencd@0
|
473 CHECK_TYPE_SIZE("int" SIZEOF_INT)
|
|
ferencd@0
|
474 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
|
ferencd@0
|
475 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
|
ferencd@0
|
476 CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
|
|
ferencd@0
|
477
|
|
ferencd@0
|
478 SET(CMAKE_EXTRA_INCLUDE_FILES cstdint)
|
|
ferencd@0
|
479 CHECK_TYPE_SIZE("int64_t" SIZEOF_INT64_T)
|
|
ferencd@0
|
480 SET(CMAKE_EXTRA_INCLUDE_FILES)
|
|
ferencd@0
|
481
|
|
ferencd@0
|
482
|
|
ferencd@0
|
483 IF(SIZEOF_CHAR EQUAL 1)
|
|
ferencd@0
|
484 SET(VMIME_8BIT_TYPE "char")
|
|
ferencd@0
|
485 ELSE()
|
|
ferencd@0
|
486 MESSAGE(FATAL_ERROR "Cannot determine 8-bit type")
|
|
ferencd@0
|
487 ENDIF()
|
|
ferencd@0
|
488
|
|
ferencd@0
|
489 IF(SIZEOF_INT EQUAL 2)
|
|
ferencd@0
|
490 SET(VMIME_16BIT_TYPE "int")
|
|
ferencd@0
|
491 ELSE()
|
|
ferencd@0
|
492 IF(SIZEOF_SHORT EQUAL 2)
|
|
ferencd@0
|
493 SET(VMIME_16BIT_TYPE "short")
|
|
ferencd@0
|
494 ELSE()
|
|
ferencd@0
|
495 MESSAGE(FATAL_ERROR "Cannot determine 16-bit type")
|
|
ferencd@0
|
496 ENDIF()
|
|
ferencd@0
|
497 ENDIF()
|
|
ferencd@0
|
498
|
|
ferencd@0
|
499 IF(SIZEOF_INT EQUAL 4)
|
|
ferencd@0
|
500 SET(VMIME_32BIT_TYPE "int")
|
|
ferencd@0
|
501 ELSE()
|
|
ferencd@0
|
502 IF(SIZEOF_LONG EQUAL 4)
|
|
ferencd@0
|
503 SET(VMIME_32BIT_TYPE "long")
|
|
ferencd@0
|
504 ELSE()
|
|
ferencd@0
|
505 IF(SIZEOF_LONG_LONG EQUAL 4)
|
|
ferencd@0
|
506 SET(VMIME_32BIT_TYPE "long long")
|
|
ferencd@0
|
507 ELSE()
|
|
ferencd@0
|
508 MESSAGE(FATAL_ERROR "Cannot determine 32-bit type")
|
|
ferencd@0
|
509 ENDIF()
|
|
ferencd@0
|
510 ENDIF()
|
|
ferencd@0
|
511 ENDIF()
|
|
ferencd@0
|
512
|
|
ferencd@0
|
513 IF(SIZEOF_INT EQUAL 8)
|
|
ferencd@0
|
514 SET(VMIME_64BIT_TYPE "int")
|
|
ferencd@0
|
515 ELSE()
|
|
ferencd@0
|
516 IF(SIZEOF_LONG EQUAL 8)
|
|
ferencd@0
|
517 SET(VMIME_64BIT_TYPE "long")
|
|
ferencd@0
|
518 ELSE()
|
|
ferencd@0
|
519 IF(SIZEOF_LONG_LONG EQUAL 8)
|
|
ferencd@0
|
520 SET(VMIME_64BIT_TYPE "long long")
|
|
ferencd@0
|
521 ELSE()
|
|
ferencd@0
|
522 IF(SIZEOF_INT64_T EQUAL 8)
|
|
ferencd@0
|
523 SET(VMIME_64BIT_TYPE "int64_t")
|
|
ferencd@0
|
524 ELSE()
|
|
ferencd@0
|
525 IF(SIZEOF___INT64 EQUAL 8)
|
|
ferencd@0
|
526 SET(VMIME_64BIT_TYPE "__int64")
|
|
ferencd@0
|
527 ELSE()
|
|
ferencd@0
|
528 MESSAGE(FATAL_ERROR "Cannot determine 64-bit type")
|
|
ferencd@0
|
529 ENDIF()
|
|
ferencd@0
|
530 ENDIF()
|
|
ferencd@0
|
531 ENDIF()
|
|
ferencd@0
|
532 ENDIF()
|
|
ferencd@0
|
533 ENDIF()
|
|
ferencd@0
|
534
|
|
ferencd@0
|
535
|
|
ferencd@0
|
536 INCLUDE(cmake/TargetArch.cmake)
|
|
ferencd@0
|
537 TARGET_ARCHITECTURE(CMAKE_TARGET_ARCHITECTURES)
|
|
ferencd@0
|
538
|
|
ferencd@0
|
539 CHECK_TYPE_SIZE(size_t VMIME_HAVE_SIZE_T)
|
|
ferencd@0
|
540
|
|
ferencd@0
|
541
|
|
ferencd@0
|
542 ##############################################################################
|
|
ferencd@0
|
543 # Sendmail path
|
|
ferencd@0
|
544
|
|
ferencd@0
|
545 FOREACH (SENDMAIL_PATH /usr/sbin/sendmail /usr/lib/sendmail /usr/bin/sendmail /bin/sendmail /var/qmail/bin/qmail-inject /bin/cgimail)
|
|
ferencd@0
|
546 IF(EXISTS ${SENDMAIL_PATH})
|
|
ferencd@0
|
547 MESSAGE(STATUS "Sendmail binary found at ${SENDMAIL_PATH}")
|
|
ferencd@0
|
548 SET(VMIME_DEFAULT_SENDMAIL_PATH ${SENDMAIL_PATH})
|
|
ferencd@0
|
549 ENDIF()
|
|
ferencd@0
|
550 ENDFOREACH(SENDMAIL_PATH)
|
|
ferencd@0
|
551
|
|
ferencd@0
|
552 SET(
|
|
ferencd@0
|
553 VMIME_SENDMAIL_PATH
|
|
ferencd@0
|
554 ${VMIME_DEFAULT_SENDMAIL_PATH}
|
|
ferencd@0
|
555 CACHE
|
|
ferencd@0
|
556 STRING
|
|
ferencd@0
|
557 "Specifies the path to sendmail binary"
|
|
ferencd@0
|
558 )
|
|
ferencd@0
|
559
|
|
ferencd@0
|
560
|
|
ferencd@0
|
561 ##############################################################################
|
|
ferencd@0
|
562 # Messaging features
|
|
ferencd@0
|
563
|
|
ferencd@0
|
564 # Module
|
|
ferencd@0
|
565 OPTION(
|
|
ferencd@0
|
566 VMIME_HAVE_MESSAGING_FEATURES
|
|
ferencd@0
|
567 "Enable messaging features (connection to IMAP, POP3, SMTP...)"
|
|
ferencd@0
|
568 ON
|
|
ferencd@0
|
569 )
|
|
ferencd@0
|
570
|
|
ferencd@0
|
571 # Protocols
|
|
ferencd@0
|
572 OPTION(
|
|
ferencd@0
|
573 VMIME_HAVE_MESSAGING_PROTO_POP3
|
|
ferencd@0
|
574 "Enable POP3 protocol"
|
|
ferencd@0
|
575 ON
|
|
ferencd@0
|
576 )
|
|
ferencd@0
|
577
|
|
ferencd@0
|
578 OPTION(
|
|
ferencd@0
|
579 VMIME_HAVE_MESSAGING_PROTO_SMTP
|
|
ferencd@0
|
580 "Enable SMTP protocol"
|
|
ferencd@0
|
581 ON
|
|
ferencd@0
|
582 )
|
|
ferencd@0
|
583
|
|
ferencd@0
|
584 OPTION(
|
|
ferencd@0
|
585 VMIME_HAVE_MESSAGING_PROTO_IMAP
|
|
ferencd@0
|
586 "Enable IMAP protocol"
|
|
ferencd@0
|
587 ON
|
|
ferencd@0
|
588 )
|
|
ferencd@0
|
589
|
|
ferencd@0
|
590 OPTION(
|
|
ferencd@0
|
591 VMIME_HAVE_MESSAGING_PROTO_MAILDIR
|
|
ferencd@0
|
592 "Enable Maildir protocol"
|
|
ferencd@0
|
593 ON
|
|
ferencd@0
|
594 )
|
|
ferencd@0
|
595
|
|
ferencd@0
|
596 OPTION(
|
|
ferencd@0
|
597 VMIME_HAVE_MESSAGING_PROTO_SENDMAIL
|
|
ferencd@0
|
598 "Enable Sendmail protocol"
|
|
ferencd@0
|
599 ON
|
|
ferencd@0
|
600 )
|
|
ferencd@0
|
601
|
|
ferencd@0
|
602
|
|
ferencd@0
|
603 ##############################################################################
|
|
ferencd@0
|
604 # File-system features
|
|
ferencd@0
|
605
|
|
ferencd@0
|
606 OPTION(
|
|
ferencd@0
|
607 VMIME_HAVE_FILESYSTEM_FEATURES
|
|
ferencd@0
|
608 "Enable file-system features (required for file attachments and Maildir)"
|
|
ferencd@0
|
609 ON
|
|
ferencd@0
|
610 )
|
|
ferencd@0
|
611
|
|
ferencd@0
|
612
|
|
ferencd@0
|
613 ##############################################################################
|
|
ferencd@0
|
614 # SASL support
|
|
ferencd@0
|
615
|
|
ferencd@0
|
616 INCLUDE(cmake/FindGSasl.cmake)
|
|
ferencd@0
|
617
|
|
ferencd@0
|
618 OPTION(
|
|
ferencd@0
|
619 VMIME_HAVE_SASL_SUPPORT
|
|
ferencd@0
|
620 "Enable SASL support (requires GNU SASL library)"
|
|
ferencd@0
|
621 ON
|
|
ferencd@0
|
622 )
|
|
ferencd@0
|
623
|
|
ferencd@0
|
624 IF(VMIME_HAVE_SASL_SUPPORT)
|
|
ferencd@0
|
625
|
|
ferencd@0
|
626 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
627 ${INCLUDE_DIRECTORIES}
|
|
ferencd@0
|
628 ${GSASL_INCLUDE_DIR}
|
|
ferencd@0
|
629 )
|
|
ferencd@0
|
630
|
|
ferencd@0
|
631 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
632 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
633 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
634 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
635 ${GSASL_LIBRARIES}
|
|
ferencd@0
|
636 )
|
|
ferencd@0
|
637 ENDIF()
|
|
ferencd@0
|
638
|
|
ferencd@0
|
639 SET(VMIME_PKGCONFIG_REQUIRES "${VMIME_PKGCONFIG_REQUIRES} libgsasl")
|
|
ferencd@0
|
640
|
|
ferencd@0
|
641 ENDIF()
|
|
ferencd@0
|
642
|
|
ferencd@0
|
643
|
|
ferencd@0
|
644 ##############################################################################
|
|
ferencd@0
|
645 # SSL/TLS support
|
|
ferencd@0
|
646
|
|
ferencd@0
|
647 INCLUDE(FindGnuTLS)
|
|
ferencd@0
|
648 INCLUDE(FindOpenSSL)
|
|
ferencd@0
|
649
|
|
ferencd@0
|
650 SET(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARY}")
|
|
ferencd@0
|
651 CHECK_FUNCTION_EXISTS(gnutls_priority_set_direct VMIME_HAVE_GNUTLS_PRIORITY_FUNCS)
|
|
ferencd@0
|
652
|
|
ferencd@0
|
653
|
|
ferencd@0
|
654 OPTION(
|
|
ferencd@0
|
655 VMIME_HAVE_TLS_SUPPORT
|
|
ferencd@0
|
656 "SSL/TLS support (requires either GNU TLS or OpenSSL library)"
|
|
ferencd@0
|
657 ON
|
|
ferencd@0
|
658 )
|
|
ferencd@0
|
659
|
|
ferencd@0
|
660 SET(
|
|
ferencd@0
|
661 VMIME_TLS_SUPPORT_LIB
|
|
ferencd@0
|
662 "gnutls"
|
|
ferencd@0
|
663 CACHE
|
|
ferencd@0
|
664 STRING
|
|
ferencd@0
|
665 "Library to use for SSL/TLS conversion"
|
|
ferencd@0
|
666 )
|
|
ferencd@0
|
667 SET_PROPERTY(
|
|
ferencd@0
|
668 CACHE
|
|
ferencd@0
|
669 VMIME_TLS_SUPPORT_LIB
|
|
ferencd@0
|
670 PROPERTY STRINGS gnutls openssl
|
|
ferencd@0
|
671 )
|
|
ferencd@0
|
672
|
|
ferencd@0
|
673
|
|
ferencd@0
|
674 IF(VMIME_HAVE_TLS_SUPPORT)
|
|
ferencd@0
|
675
|
|
ferencd@0
|
676 IF(VMIME_TLS_SUPPORT_LIB STREQUAL "gnutls")
|
|
ferencd@0
|
677
|
|
ferencd@0
|
678 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
679 ${INCLUDE_DIRECTORIES}
|
|
ferencd@0
|
680 ${GNUTLS_INCLUDE_DIR}
|
|
ferencd@0
|
681 )
|
|
ferencd@0
|
682
|
|
ferencd@0
|
683 LINK_DIRECTORIES(
|
|
ferencd@0
|
684 ${LINK_DIRECTORIES}
|
|
ferencd@0
|
685 ${GNUTLS_LIBRARY_DIRS}
|
|
ferencd@0
|
686 )
|
|
ferencd@0
|
687
|
|
ferencd@0
|
688 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
689 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
690 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
691 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
692 ${GNUTLS_LIBRARY}
|
|
ferencd@0
|
693 )
|
|
ferencd@0
|
694 ENDIF()
|
|
ferencd@0
|
695
|
|
ferencd@0
|
696 SET(VMIME_PKGCONFIG_REQUIRES "${VMIME_PKGCONFIG_REQUIRES} gnutls")
|
|
ferencd@0
|
697
|
|
ferencd@0
|
698 SET(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS "ON")
|
|
ferencd@0
|
699 SET(VMIME_TLS_SUPPORT_LIB_IS_OPENSSL "OFF")
|
|
ferencd@0
|
700
|
|
ferencd@0
|
701 ELSEIF(VMIME_TLS_SUPPORT_LIB STREQUAL "openssl")
|
|
ferencd@0
|
702
|
|
ferencd@0
|
703 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
704 ${INCLUDE_DIRECTORIES}
|
|
ferencd@0
|
705 ${OPENSSL_INCLUDE_DIR}
|
|
ferencd@0
|
706 )
|
|
ferencd@0
|
707
|
|
ferencd@0
|
708 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
709 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
710 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
711 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
712 ${OPENSSL_LIBRARIES}
|
|
ferencd@0
|
713 )
|
|
ferencd@0
|
714 ENDIF()
|
|
ferencd@0
|
715
|
|
ferencd@0
|
716 SET(VMIME_PKGCONFIG_REQUIRES "${VMIME_PKGCONFIG_REQUIRES} openssl")
|
|
ferencd@0
|
717
|
|
ferencd@0
|
718 SET(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS "OFF")
|
|
ferencd@0
|
719 SET(VMIME_TLS_SUPPORT_LIB_IS_OPENSSL "ON")
|
|
ferencd@0
|
720
|
|
ferencd@0
|
721 ELSE()
|
|
ferencd@0
|
722
|
|
ferencd@0
|
723 MESSAGE(FATAL_ERROR "TLS support is enabled, but no TLS/SSL library was selected/found")
|
|
ferencd@0
|
724
|
|
ferencd@0
|
725 ENDIF()
|
|
ferencd@0
|
726
|
|
ferencd@0
|
727 ENDIF(VMIME_HAVE_TLS_SUPPORT)
|
|
ferencd@0
|
728
|
|
ferencd@0
|
729
|
|
ferencd@0
|
730 ##############################################################################
|
|
ferencd@0
|
731 # Charset conversion library
|
|
ferencd@0
|
732
|
|
ferencd@0
|
733 INCLUDE(cmake/FindIconv.cmake)
|
|
ferencd@0
|
734 INCLUDE(cmake/FindICU.cmake)
|
|
ferencd@0
|
735
|
|
ferencd@0
|
736 FIND_PACKAGE(ICU QUIET)
|
|
ferencd@0
|
737
|
|
ferencd@0
|
738 IF(WIN32)
|
|
ferencd@0
|
739 SET(VMIME_CHARSETCONV_LIB_DETECTED "win")
|
|
ferencd@0
|
740 ELSEIF(ICU_LIBRARIES)
|
|
ferencd@0
|
741 SET(VMIME_CHARSETCONV_LIB_DETECTED "icu")
|
|
ferencd@0
|
742 ELSEIF(ICONV_FOUND)
|
|
ferencd@0
|
743 SET(VMIME_CHARSETCONV_LIB_DETECTED "iconv")
|
|
ferencd@0
|
744 ENDIF()
|
|
ferencd@0
|
745
|
|
ferencd@0
|
746 SET(
|
|
ferencd@0
|
747 VMIME_CHARSETCONV_LIB
|
|
ferencd@0
|
748 "${VMIME_CHARSETCONV_LIB_DETECTED}"
|
|
ferencd@0
|
749 CACHE
|
|
ferencd@0
|
750 STRING
|
|
ferencd@0
|
751 "Library to use for charset conversion"
|
|
ferencd@0
|
752 )
|
|
ferencd@0
|
753 SET_PROPERTY(
|
|
ferencd@0
|
754 CACHE
|
|
ferencd@0
|
755 VMIME_CHARSETCONV_LIB
|
|
ferencd@0
|
756 PROPERTY STRINGS win iconv icu
|
|
ferencd@0
|
757 )
|
|
ferencd@0
|
758
|
|
ferencd@0
|
759
|
|
ferencd@0
|
760 IF(VMIME_CHARSETCONV_LIB STREQUAL "iconv")
|
|
ferencd@0
|
761
|
|
ferencd@0
|
762 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
763 ${INCLUDE_DIRECTORIES}
|
|
ferencd@0
|
764 ${ICONV_INCLUDE_DIR}
|
|
ferencd@0
|
765 )
|
|
ferencd@0
|
766
|
|
ferencd@0
|
767 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
768 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
769 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
770 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
771 ${ICONV_LIBRARIES}
|
|
ferencd@0
|
772 )
|
|
ferencd@0
|
773 ENDIF()
|
|
ferencd@0
|
774
|
|
ferencd@0
|
775 SET(VMIME_PKGCONFIG_LIBS "${VMIME_PKGCONFIG_LIBS} ${ICONV_LIBRARIES}")
|
|
ferencd@0
|
776 SET(VMIME_PKGCONFIG_CFLAGS "${VMIME_PKGCONFIG_CFLAGS} -I${ICONV_INCLUDE_DIR}")
|
|
ferencd@0
|
777
|
|
ferencd@0
|
778 SET(VMIME_CHARSETCONV_LIB_IS_ICONV "ON")
|
|
ferencd@0
|
779 SET(VMIME_CHARSETCONV_LIB_IS_ICU "OFF")
|
|
ferencd@0
|
780 SET(VMIME_CHARSETCONV_LIB_IS_WIN "OFF")
|
|
ferencd@0
|
781
|
|
ferencd@0
|
782 ELSEIF(VMIME_CHARSETCONV_LIB STREQUAL "icu")
|
|
ferencd@0
|
783
|
|
ferencd@0
|
784 INCLUDE_DIRECTORIES(
|
|
ferencd@0
|
785 ${INCLUDE_DIRECTORIES}
|
|
ferencd@0
|
786 ${ICU_INCLUDE_DIRS}
|
|
ferencd@0
|
787 )
|
|
ferencd@0
|
788
|
|
ferencd@0
|
789 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
790 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
791 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
792 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
793 ${ICU_LIBRARIES}
|
|
ferencd@0
|
794 )
|
|
ferencd@0
|
795 ENDIF()
|
|
ferencd@0
|
796
|
|
ferencd@0
|
797 SET(VMIME_PKGCONFIG_LIBS "${VMIME_PKGCONFIG_LIBS} ${ICU_LIBRARIES}")
|
|
ferencd@0
|
798 SET(VMIME_PKGCONFIG_CFLAGS "${VMIME_PKGCONFIG_CFLAGS} -I${ICU_INCLUDE_DIRS}")
|
|
ferencd@0
|
799
|
|
ferencd@0
|
800 SET(VMIME_CHARSETCONV_LIB_IS_ICONV "OFF")
|
|
ferencd@0
|
801 SET(VMIME_CHARSETCONV_LIB_IS_ICU "ON")
|
|
ferencd@0
|
802 SET(VMIME_CHARSETCONV_LIB_IS_WIN "OFF")
|
|
ferencd@0
|
803
|
|
ferencd@0
|
804 ELSEIF(VMIME_CHARSETCONV_LIB STREQUAL "win")
|
|
ferencd@0
|
805
|
|
ferencd@0
|
806 SET(VMIME_CHARSETCONV_LIB_IS_ICONV "OFF")
|
|
ferencd@0
|
807 SET(VMIME_CHARSETCONV_LIB_IS_ICU "OFF")
|
|
ferencd@0
|
808 SET(VMIME_CHARSETCONV_LIB_IS_WIN "ON")
|
|
ferencd@0
|
809
|
|
ferencd@0
|
810 ELSE()
|
|
ferencd@0
|
811
|
|
ferencd@0
|
812 MESSAGE(FATAL_ERROR "No charset conversion library was selected/found")
|
|
ferencd@0
|
813
|
|
ferencd@0
|
814 ENDIF()
|
|
ferencd@0
|
815
|
|
ferencd@0
|
816
|
|
ferencd@0
|
817 ##############################################################################
|
|
ferencd@0
|
818 # Language features
|
|
ferencd@0
|
819
|
|
ferencd@0
|
820 # C++11
|
|
ferencd@0
|
821 INCLUDE(cmake/cmake-cxx11/Modules/CheckCXX11Features.cmake)
|
|
ferencd@0
|
822
|
|
ferencd@0
|
823 # Smart pointers
|
|
ferencd@0
|
824 #
|
|
ferencd@0
|
825 # If a C++11-compliant compiler is available and supports std::shared_ptr<>,
|
|
ferencd@0
|
826 # use the standard implementation. Else, use boost::shared_ptr<>.
|
|
ferencd@0
|
827 # In any case, let the user override the choice with VMIME_SHARED_PTR_USE_CXX
|
|
ferencd@0
|
828 # and VMIME_SHARED_PTR_USE_BOOST variables.
|
|
ferencd@0
|
829
|
|
ferencd@0
|
830 CHECK_CXX_SOURCE_COMPILES(
|
|
ferencd@0
|
831 "
|
|
ferencd@0
|
832 #include <memory>
|
|
ferencd@0
|
833 struct A { int foo; };
|
|
ferencd@0
|
834 int main() {
|
|
ferencd@0
|
835 std::shared_ptr <A> a = std::make_shared <A>();
|
|
ferencd@0
|
836 return 0;
|
|
ferencd@0
|
837 }
|
|
ferencd@0
|
838 "
|
|
ferencd@0
|
839 VMIME_HAS_CXX11_SHARED_PTR
|
|
ferencd@0
|
840 )
|
|
ferencd@0
|
841
|
|
ferencd@0
|
842 IF(NOT VMIME_SHARED_PTR_USE_CXX AND NOT VMIME_SHARED_PTR_USE_BOOST)
|
|
ferencd@0
|
843 IF(CXX11_COMPILER_FLAGS AND VMIME_HAS_CXX11_SHARED_PTR)
|
|
ferencd@0
|
844 # If std::shared_ptr<> is available, use it by default
|
|
ferencd@0
|
845 SET(VMIME_SHARED_PTR_USE_CXX_DEFAULT ON)
|
|
ferencd@0
|
846 SET(VMIME_SHARED_PTR_USE_BOOST_DEFAULT OFF)
|
|
ferencd@0
|
847 ELSE()
|
|
ferencd@0
|
848 # Else, set default to boost::shared_ptr<>
|
|
ferencd@0
|
849 SET(VMIME_SHARED_PTR_USE_CXX_DEFAULT OFF)
|
|
ferencd@0
|
850 SET(VMIME_SHARED_PTR_USE_BOOST_DEFAULT ON)
|
|
ferencd@0
|
851 ENDIF()
|
|
ferencd@0
|
852 ENDIF()
|
|
ferencd@0
|
853
|
|
ferencd@0
|
854 OPTION(
|
|
ferencd@0
|
855 VMIME_SHARED_PTR_USE_CXX
|
|
ferencd@0
|
856 "Use standard std::shared_ptr<> (requires a C++11 compiler)"
|
|
ferencd@0
|
857 ${VMIME_SHARED_PTR_USE_CXX_DEFAULT}
|
|
ferencd@0
|
858 )
|
|
ferencd@0
|
859
|
|
ferencd@0
|
860 OPTION(
|
|
ferencd@0
|
861 VMIME_SHARED_PTR_USE_BOOST
|
|
ferencd@0
|
862 "Use boost::shared_ptr<> (requires Boost)"
|
|
ferencd@0
|
863 ${VMIME_SHARED_PTR_USE_BOOST_DEFAULT}
|
|
ferencd@0
|
864 )
|
|
ferencd@0
|
865
|
|
ferencd@0
|
866 IF(VMIME_SHARED_PTR_USE_CXX AND VMIME_SHARED_PTR_USE_BOOST)
|
|
ferencd@0
|
867 MESSAGE(FATAL_ERROR "Options VMIME_SHARED_PTR_USE_CXX and VMIME_SHARED_PTR_USE_BOOST are mutually exclusive (select one or the other, but not both!)")
|
|
ferencd@0
|
868 ENDIF()
|
|
ferencd@0
|
869
|
|
ferencd@0
|
870 IF(VMIME_SHARED_PTR_USE_CXX)
|
|
ferencd@0
|
871
|
|
ferencd@0
|
872 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
|
|
ferencd@0
|
873
|
|
ferencd@0
|
874 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
ferencd@0
|
875 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
|
ferencd@0
|
876 ENDIF()
|
|
ferencd@0
|
877
|
|
ferencd@0
|
878 MESSAGE(STATUS "Checking support for shared_ptr<>: built-in (C++11)")
|
|
ferencd@0
|
879
|
|
ferencd@0
|
880 ELSEIF(VMIME_SHARED_PTR_USE_BOOST)
|
|
ferencd@0
|
881
|
|
ferencd@0
|
882 # Depends on Boost library if C++11 is not supported
|
|
ferencd@0
|
883 FIND_PACKAGE(Boost)
|
|
ferencd@0
|
884
|
|
ferencd@0
|
885 IF(Boost_FOUND)
|
|
ferencd@0
|
886 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
|
ferencd@0
|
887 ELSE()
|
|
ferencd@0
|
888 MESSAGE(FATAL_ERROR "Boost library is required for shared_ptr<>, unless you compile using C++11")
|
|
ferencd@0
|
889 ENDIF()
|
|
ferencd@0
|
890
|
|
ferencd@0
|
891 MESSAGE(STATUS "Checking support for shared_ptr<>: boost library")
|
|
ferencd@0
|
892
|
|
ferencd@0
|
893 ELSE()
|
|
ferencd@0
|
894
|
|
ferencd@0
|
895 MESSAGE(FATAL_ERROR "No implementation for shared_ptr<> was selected/found")
|
|
ferencd@0
|
896
|
|
ferencd@0
|
897 ENDIF()
|
|
ferencd@0
|
898
|
|
ferencd@0
|
899
|
|
ferencd@0
|
900 ##############################################################################
|
|
ferencd@0
|
901 # Platform
|
|
ferencd@0
|
902
|
|
ferencd@0
|
903 SET(VMIME_PLATFORM_IS_POSIX OFF)
|
|
ferencd@0
|
904 SET(VMIME_PLATFORM_IS_WINDOWS OFF)
|
|
ferencd@0
|
905
|
|
ferencd@0
|
906 IF(WIN32)
|
|
ferencd@0
|
907 SET(VMIME_PLATFORM_IS_WINDOWS ON)
|
|
ferencd@0
|
908 ELSE()
|
|
ferencd@0
|
909 SET(VMIME_PLATFORM_IS_POSIX ON)
|
|
ferencd@0
|
910 ENDIF()
|
|
ferencd@0
|
911
|
|
ferencd@0
|
912
|
|
ferencd@0
|
913 ##############################################################################
|
|
ferencd@0
|
914 # Platform-specific checks
|
|
ferencd@0
|
915
|
|
ferencd@0
|
916 CHECK_FUNCTION_EXISTS(gmtime_s VMIME_HAVE_GMTIME_S)
|
|
ferencd@0
|
917 CHECK_FUNCTION_EXISTS(gmtime_r VMIME_HAVE_GMTIME_R)
|
|
ferencd@0
|
918 CHECK_FUNCTION_EXISTS(localtime_s VMIME_HAVE_LOCALTIME_S)
|
|
ferencd@0
|
919 CHECK_FUNCTION_EXISTS(localtime_r VMIME_HAVE_LOCALTIME_R)
|
|
ferencd@0
|
920 CHECK_FUNCTION_EXISTS(strcpy_s VMIME_HAVE_STRCPY_S)
|
|
ferencd@0
|
921
|
|
ferencd@0
|
922
|
|
ferencd@0
|
923 ##############################################################################
|
|
ferencd@0
|
924 # Windows-specific checks
|
|
ferencd@0
|
925
|
|
ferencd@0
|
926 IF(WIN32)
|
|
ferencd@0
|
927
|
|
ferencd@0
|
928 # Winsock
|
|
ferencd@0
|
929 CHECK_LIBRARY_EXISTS("ws2_32" getch "${CMAKE_LIBRARY_PATH}" VMIME_HAVE_LIBWS2_32)
|
|
ferencd@0
|
930
|
|
ferencd@0
|
931 IF(VMIME_HAVE_LIBWS2_32)
|
|
ferencd@0
|
932 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
933 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
934 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
935 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
936 "ws2_32"
|
|
ferencd@0
|
937 )
|
|
ferencd@0
|
938 ELSE()
|
|
ferencd@0
|
939 SET(VMIME_PKGCONFIG_LIBS "${VMIME_PKGCONFIG_LIBS} -lws2_32")
|
|
ferencd@0
|
940 ENDIF()
|
|
ferencd@0
|
941 ENDIF()
|
|
ferencd@0
|
942
|
|
ferencd@0
|
943 # MLang
|
|
ferencd@0
|
944 CHECK_INCLUDE_FILES(Mlang.h VMIME_HAVE_MLANG_H)
|
|
ferencd@0
|
945 CHECK_LIBRARY_EXISTS("mlang" ConvertINetString "${CMAKE_LIBRARY_PATH}" VMIME_HAVE_MLANG_LIB)
|
|
ferencd@0
|
946
|
|
ferencd@0
|
947 IF(VMIME_HAVE_MLANG_H)
|
|
ferencd@0
|
948 IF(VMIME_HAVE_MLANG_LIB)
|
|
ferencd@0
|
949 SET(VMIME_HAVE_MLANG ON)
|
|
ferencd@0
|
950
|
|
ferencd@0
|
951 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
952 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
953 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
954 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
955 "mlang"
|
|
ferencd@0
|
956 )
|
|
ferencd@0
|
957 ENDIF()
|
|
ferencd@0
|
958 ENDIF()
|
|
ferencd@0
|
959 ENDIF()
|
|
ferencd@0
|
960
|
|
ferencd@0
|
961 ENDIF()
|
|
ferencd@0
|
962
|
|
ferencd@0
|
963
|
|
ferencd@0
|
964 ##############################################################################
|
|
ferencd@0
|
965 # POSIX-specific checks
|
|
ferencd@0
|
966
|
|
ferencd@0
|
967 CHECK_FUNCTION_EXISTS(getaddrinfo VMIME_HAVE_GETADDRINFO)
|
|
ferencd@0
|
968 CHECK_FUNCTION_EXISTS(getnameinfo VMIME_HAVE_GETNAMEINFO)
|
|
ferencd@0
|
969
|
|
ferencd@0
|
970 CHECK_FUNCTION_EXISTS(gettid VMIME_HAVE_GETTID)
|
|
ferencd@0
|
971 CHECK_FUNCTION_EXISTS(syscall VMIME_HAVE_SYSCALL)
|
|
ferencd@0
|
972 CHECK_SYMBOL_EXISTS(SYS_gettid sys/syscall.h VMIME_HAVE_SYSCALL_GETTID)
|
|
ferencd@0
|
973
|
|
ferencd@0
|
974 FIND_PACKAGE(Threads)
|
|
ferencd@0
|
975
|
|
ferencd@0
|
976 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
977 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
978 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
979 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
980 ${CMAKE_THREAD_LIBS_INIT}
|
|
ferencd@0
|
981 )
|
|
ferencd@0
|
982 ENDIF()
|
|
ferencd@0
|
983
|
|
ferencd@0
|
984 FIND_LIBRARY(PTHREAD_LIB pthread)
|
|
ferencd@0
|
985
|
|
ferencd@0
|
986 IF(PTHREAD_LIB)
|
|
ferencd@0
|
987 SET(VMIME_HAVE_PTHREAD 1)
|
|
ferencd@0
|
988
|
|
ferencd@0
|
989 IF(VMIME_BUILD_SHARED_LIBRARY)
|
|
ferencd@0
|
990 TARGET_LINK_LIBRARIES(
|
|
ferencd@0
|
991 ${VMIME_LIBRARY_NAME}
|
|
ferencd@0
|
992 ${TARGET_LINK_LIBRARIES}
|
|
ferencd@0
|
993 ${PTHREAD_LIB}
|
|
ferencd@0
|
994 )
|
|
ferencd@0
|
995 ENDIF()
|
|
ferencd@0
|
996 ELSE(PTHREAD_LIB)
|
|
ferencd@0
|
997 SET(VMIME_HAVE_PTHREAD 0)
|
|
ferencd@0
|
998 ENDIF(PTHREAD_LIB)
|
|
ferencd@0
|
999
|
|
ferencd@0
|
1000
|
|
ferencd@0
|
1001 ##############################################################################
|
|
ferencd@0
|
1002 # Additional compiler flags
|
|
ferencd@0
|
1003
|
|
ferencd@0
|
1004 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
ferencd@0
|
1005
|
|
ferencd@0
|
1006 SET(
|
|
ferencd@0
|
1007 CMAKE_CXX_FLAGS
|
|
ferencd@0
|
1008 "${CMAKE_CXX_FLAGS} -D_REENTRANT=1 -W -Wall -pedantic -Warray-bounds-pointer-arithmetic -Wold-style-cast -Wconversion -Wcast-align -Wno-sign-conversion"
|
|
ferencd@0
|
1009 CACHE STRING
|
|
ferencd@0
|
1010 "g++ Compiler Flags"
|
|
ferencd@0
|
1011 FORCE
|
|
ferencd@0
|
1012 )
|
|
ferencd@0
|
1013
|
|
ferencd@0
|
1014 SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
|
ferencd@0
|
1015 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
|
ferencd@0
|
1016 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
|
ferencd@0
|
1017
|
|
ferencd@0
|
1018 #SET(CMAKE_EXE_LINKER_FLAGS "-s")
|
|
ferencd@0
|
1019
|
|
ferencd@0
|
1020 ELSE()
|
|
ferencd@0
|
1021
|
|
ferencd@0
|
1022 IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
ferencd@0
|
1023
|
|
ferencd@0
|
1024 SET(
|
|
ferencd@0
|
1025 CMAKE_CXX_FLAGS
|
|
ferencd@0
|
1026 "${CMAKE_CXX_FLAGS} -D_REENTRANT=1 -W -Wall -pedantic -Wpointer-arith -Wold-style-cast -Wconversion -Wcast-align -Wno-long-long"
|
|
ferencd@0
|
1027 CACHE STRING
|
|
ferencd@0
|
1028 "g++ Compiler Flags"
|
|
ferencd@0
|
1029 FORCE
|
|
ferencd@0
|
1030 )
|
|
ferencd@0
|
1031
|
|
ferencd@0
|
1032 SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
|
ferencd@0
|
1033 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
|
ferencd@0
|
1034 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
|
ferencd@0
|
1035
|
|
ferencd@0
|
1036 #SET(CMAKE_EXE_LINKER_FLAGS "-s")
|
|
ferencd@0
|
1037
|
|
ferencd@0
|
1038 ENDIF()
|
|
ferencd@0
|
1039
|
|
ferencd@0
|
1040 ENDIF()
|
|
ferencd@0
|
1041
|
|
ferencd@0
|
1042
|
|
ferencd@0
|
1043 ##############################################################################
|
|
ferencd@0
|
1044 # Documentation
|
|
ferencd@0
|
1045
|
|
ferencd@0
|
1046 OPTION(
|
|
ferencd@0
|
1047 VMIME_BUILD_DOCUMENTATION
|
|
ferencd@0
|
1048 "Build documentation"
|
|
ferencd@0
|
1049 ON
|
|
ferencd@0
|
1050 )
|
|
ferencd@0
|
1051
|
|
ferencd@0
|
1052 IF(VMIME_BUILD_DOCUMENTATION)
|
|
ferencd@0
|
1053 FIND_PACKAGE(Doxygen)
|
|
ferencd@0
|
1054
|
|
ferencd@0
|
1055 IF(DOXYGEN_FOUND)
|
|
ferencd@0
|
1056 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
|
|
ferencd@0
|
1057
|
|
ferencd@0
|
1058 # Make a target so that documentation can be generated by running "make doc"
|
|
ferencd@0
|
1059 ADD_CUSTOM_TARGET(
|
|
ferencd@0
|
1060 doc
|
|
ferencd@0
|
1061 ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
|
|
ferencd@0
|
1062 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
ferencd@0
|
1063 COMMENT "Generating API documentation with Doxygen" VERBATIM
|
|
ferencd@0
|
1064 )
|
|
ferencd@0
|
1065 ENDIF(DOXYGEN_FOUND)
|
|
ferencd@0
|
1066 ENDIF(VMIME_BUILD_DOCUMENTATION)
|
|
ferencd@0
|
1067
|
|
ferencd@0
|
1068 ##############################################################################
|
|
ferencd@0
|
1069 # Sanity checks
|
|
ferencd@0
|
1070
|
|
ferencd@0
|
1071 # Maildir protocol is available only if file-system features are enabled
|
|
ferencd@0
|
1072 IF(VMIME_HAVE_MESSAGING_FEATURES AND VMIME_HAVE_MESSAGING_PROTO_MAILDIR AND NOT VMIME_HAVE_FILESYSTEM_FEATURES)
|
|
ferencd@0
|
1073 MESSAGE(FATAL_ERROR "Maildir protocol requires file-system support (VMIME_HAVE_FILESYSTEM_FEATURES must be set to ON).")
|
|
ferencd@0
|
1074 ENDIF()
|
|
ferencd@0
|
1075
|
|
ferencd@0
|
1076 # Path to 'sendmail' must be specified if Sendmail protocol is enabled
|
|
ferencd@0
|
1077 IF(VMIME_HAVE_MESSAGING_PROTO_SENDMAIL)
|
|
ferencd@0
|
1078 IF(NOT VMIME_SENDMAIL_PATH OR VMIME_SENDMAIL_PATH STREQUAL "")
|
|
ferencd@0
|
1079 MESSAGE(FATAL_ERROR "Enabling Sendmail protocol requires that you specify path to 'sendmail' binary.")
|
|
ferencd@0
|
1080 ENDIF()
|
|
ferencd@0
|
1081 ENDIF()
|
|
ferencd@0
|
1082
|
|
ferencd@0
|
1083
|
|
ferencd@0
|
1084 ##############################################################################
|
|
ferencd@0
|
1085 # Build examples
|
|
ferencd@0
|
1086
|
|
ferencd@0
|
1087 IF(VMIME_BUILD_SAMPLES)
|
|
ferencd@0
|
1088 ADD_SUBDIRECTORY(examples)
|
|
ferencd@0
|
1089 ENDIF()
|
|
ferencd@0
|
1090
|
|
ferencd@0
|
1091
|
|
ferencd@0
|
1092 # Set our configure file
|
|
ferencd@0
|
1093 CONFIGURE_FILE(cmake/config.hpp.cmake ${CMAKE_SOURCE_DIR}/src/vmime/config.hpp)
|
|
ferencd@0
|
1094
|
|
ferencd@0
|
1095 # PkgConfig post-configuration
|
|
ferencd@0
|
1096 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/vmime.pc.in ${CMAKE_BINARY_DIR}/vmime.pc @ONLY)
|
|
ferencd@0
|
1097 INSTALL(FILES ${CMAKE_BINARY_DIR}/vmime.pc DESTINATION "${VMIME_INSTALL_LIBDIR}/pkgconfig" COMPONENT headers)
|
|
ferencd@0
|
1098
|
|
ferencd@0
|
1099 INCLUDE(CPack)
|
|
ferencd@0
|
1100
|