forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
462 lines (404 loc) · 18.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
include(CheckSymbolExists)
set(SOURCEKIT_VERSION_STRING "${SWIFT_COMPILER_VERSION}")
set(SOURCEKIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SOURCEKIT_BINARY_DIR ${SWIFT_BINARY_DIR})
set(SOURCEKIT_RUNTIME_OUTPUT_INTDIR "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
set(SOURCEKIT_LIBRARY_OUTPUT_INTDIR "${SWIFT_LIBRARY_OUTPUT_INTDIR}")
check_symbol_exists(dispatch_block_create "dispatch/dispatch.h" HAVE_DISPATCH_BLOCK_CREATE)
configure_file(
${SOURCEKIT_SOURCE_DIR}/include/SourceKit/Config/config.h.cmake
${SOURCEKIT_BINARY_DIR}/include/SourceKit/Config/config.h)
set(SOURCEKIT_DEPLOYMENT_OS "${SWIFT_HOST_VARIANT}")
set(SOURCEKIT_DEPLOYMENT_TARGET "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
function(add_sourcekit_symbol_exports target_name export_file)
# Makefile.rules contains special cases for different platforms.
# We restrict ourselves to Darwin for the time being.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
add_custom_command(OUTPUT symbol.exports
COMMAND sed -e "s/^/_/" < ${export_file} > symbol.exports
DEPENDS ${export_file}
VERBATIM
COMMENT "Creating export file for ${target_name}")
add_custom_target(${target_name}_exports DEPENDS symbol.exports)
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES symbol.exports)
get_property(srcs TARGET ${target_name} PROPERTY SOURCES)
foreach(src ${srcs})
get_filename_component(extension ${src} EXT)
if(extension STREQUAL ".cpp")
set(first_source_file ${src})
break()
endif()
endforeach()
# Force re-linking when the exports file changes. Actually, it
# forces recompilation of the source file. The LINK_DEPENDS target
# property only works for makefile-based generators.
set_property(SOURCE ${first_source_file} APPEND PROPERTY
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/symbol.exports)
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/symbol.exports")
add_dependencies(${target_name} ${target_name}_exports)
endif()
endfunction()
# Add a new SourceKit library.
#
# Usage:
# add_sourcekit_library(name # Name of the library
# [DEPENDS dep1 ...] # Libraries this library depends on
# [COMPONENT_DEPENDS comp1 ...] # LLVM components this library depends on
# [INSTALL_IN_COMPONENT comp] # The Swift installation component that this library belongs to.
# [SHARED]
# source1 [source2 source3 ...]) # Sources to add into this library
macro(add_sourcekit_library name)
cmake_parse_arguments(SOURCEKITLIB
"SHARED"
"INSTALL_IN_COMPONENT"
"DEPENDS;COMPONENT_DEPENDS"
${ARGN})
set(srcs ${SOURCEKITLIB_UNPARSED_ARGUMENTS})
llvm_process_sources(srcs ${srcs})
if(MSVC_IDE OR XCODE)
# Add public headers
file(RELATIVE_PATH lib_path
${SOURCEKIT_SOURCE_DIR}/lib/
${CMAKE_CURRENT_SOURCE_DIR}
)
if(NOT lib_path MATCHES "^[.][.]")
file( GLOB_RECURSE headers
${SOURCEKIT_SOURCE_DIR}/include/SourceKit/${lib_path}/*.h
${SOURCEKIT_SOURCE_DIR}/include/SourceKit/${lib_path}/*.def
)
set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
file( GLOB_RECURSE tds
${SOURCEKIT_SOURCE_DIR}/include/SourceKit/${lib_path}/*.td
)
source_group("TableGen descriptions" FILES ${tds})
set_source_files_properties(${tds}} PROPERTIES HEADER_FILE_ONLY ON)
set(srcs ${srcs} ${headers} ${tds})
endif()
endif()
if (MODULE)
set(libkind MODULE)
elseif(SOURCEKITLIB_SHARED)
set(libkind SHARED)
else()
set(libkind)
endif()
add_library( ${name} ${libkind} ${srcs} )
llvm_update_compile_flags(${name})
set_output_directory(${name}
BINARY_DIR ${SOURCEKIT_RUNTIME_OUTPUT_INTDIR}
LIBRARY_DIR ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
set(prefixed_link_libraries)
foreach(dep ${SOURCEKITLIB_DEPENDS})
if("${dep}" MATCHES "^clang")
set(dep "${LLVM_LIBRARY_OUTPUT_INTDIR}/lib${dep}.a")
endif()
if("${dep}" STREQUAL "cmark")
set(dep "${CMARK_LIBRARY_DIR}/lib${dep}.a")
endif()
list(APPEND prefixed_link_libraries "${dep}")
endforeach()
set(SOURCEKITLIB_DEPENDS "${prefixed_link_libraries}")
if("${libkind}" STREQUAL "SHARED")
target_link_libraries("${name}" PRIVATE ${SOURCEKITLIB_DEPENDS})
else()
target_link_libraries("${name}" INTERFACE ${SOURCEKITLIB_DEPENDS})
endif()
swift_common_llvm_config( ${name} ${SOURCEKITLIB_COMPONENT_DEPENDS} )
if(SOURCEKITLIB_SHARED AND EXPORTED_SYMBOL_FILE)
add_sourcekit_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
if(SOURCEKITLIB_SHARED)
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(${name} PROPERTIES INSTALL_NAME_DIR "@rpath")
endif()
endif()
if("${SOURCEKITLIB_INSTALL_IN_COMPONENT}" STREQUAL "")
if(SOURCEKITLIB_SHARED)
set(SOURCEKITLIB_INSTALL_IN_COMPONENT tools)
else()
set(SOURCEKITLIB_INSTALL_IN_COMPONENT dev)
endif()
endif()
swift_install_in_component("${SOURCEKITLIB_INSTALL_IN_COMPONENT}"
TARGETS ${name}
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}"
RUNTIME DESTINATION "bin")
set_target_properties(${name} PROPERTIES FOLDER "SourceKit libraries")
endmacro()
# Add a new SourceKit executable.
#
# Usage:
# add_sourcekit_executable(name # Name of the executable
# [DEPENDS dep1 ...] # Libraries this executable depends on
# [COMPONENT_DEPENDS comp1 ...] # LLVM components this executable
# # depends on
# [EXCLUDE_FROM_ALL] # Whether to exclude this executable from
# # the ALL_BUILD target
# source1 [source2 source3 ...]) # Sources to add into this executable
macro(add_sourcekit_executable name)
cmake_parse_arguments(SOURCEKITEXE
"EXCLUDE_FROM_ALL"
""
"DEPENDS;COMPONENT_DEPENDS"
${ARGN})
if (${SOURCEKITEXE_EXCLUDE_FROM_ALL})
add_executable(${name} EXCLUDE_FROM_ALL ${SOURCEKITEXE_UNPARSED_ARGUMENTS})
else()
add_executable(${name} ${SOURCEKITEXE_UNPARSED_ARGUMENTS})
endif()
llvm_update_compile_flags(${name})
set_output_directory(${name}
BINARY_DIR ${SOURCEKIT_RUNTIME_OUTPUT_INTDIR}
LIBRARY_DIR ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
# Add appropriate dependencies
if(LLVM_COMMON_DEPENDS)
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif()
target_link_libraries(${name} ${SOURCEKITEXE_DEPENDS})
swift_common_llvm_config(${name} ${SOURCEKITEXE_COMPONENT_DEPENDS})
target_link_libraries(${name} ${LLVM_COMMON_LIBS})
set_target_properties(${name} PROPERTIES FOLDER "SourceKit executables")
if (NOT SWIFT_ASAN_BUILD)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set_target_properties(${name}
PROPERTIES
LINK_FLAGS "-Wl,-exported_symbol,_main")
endif()
endif()
endmacro()
# Add a new SourceKit framework.
#
# Usage:
# add_sourcekit_framework(name # Name of the framework
# [DEPENDS dep1 ...] # Libraries this framework depends on
# [COMPONENT_DEPENDS comp1 ...] # LLVM components this framework depends on
# [MODULEMAP modulemap] # Module map file for this framework
# [INSTALL_IN_COMPONENT comp] # The Swift installation component that this framework belongs to.
# source1 [source2 source3 ...]) # Sources to add into this framework
macro(add_sourcekit_framework name)
cmake_parse_arguments(SOURCEKITFW
"" "MODULEMAP;INSTALL_IN_COMPONENT" "DEPENDS;COMPONENT_DEPENDS" ${ARGN})
set(srcs ${SOURCEKITFW_UNPARSED_ARGUMENTS})
set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
set(framework_location "${lib_dir}/${name}.framework")
if (NOT SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
set(FLAT_FRAMEWORK_NAME "${name}")
set(FLAT_FRAMEWORK_IDENTIFIER "com.apple.${name}")
set(FLAT_FRAMEWORK_SHORT_VERSION_STRING "1.0")
set(FLAT_FRAMEWORK_BUNDLE_VERSION "${SOURCEKIT_VERSION_STRING}")
set(FLAT_FRAMEWORK_DEPLOYMENT_TARGET "${SOURCEKIT_DEPLOYMENT_TARGET}")
configure_file(
"${SOURCEKIT_SOURCE_DIR}/cmake/FlatFrameworkInfo.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist")
add_custom_command(OUTPUT "${framework_location}/Info.plist"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist" "${framework_location}/Info.plist")
list(APPEND srcs "${framework_location}/Info.plist")
endif()
llvm_process_sources(srcs ${srcs})
add_library( ${name} SHARED ${srcs} )
llvm_update_compile_flags(${name})
set(headers)
foreach(src ${srcs})
get_filename_component(extension ${src} EXT)
if(extension STREQUAL ".h")
list(APPEND headers ${src})
endif()
endforeach()
if(MSVC_IDE OR XCODE)
set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
endif(MSVC_IDE OR XCODE)
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
target_link_libraries( ${name} PRIVATE ${SOURCEKITFW_DEPENDS} )
swift_common_llvm_config( ${name} ${SOURCEKITFW_COMPONENT_DEPENDS} )
if (EXPORTED_SYMBOL_FILE)
add_sourcekit_symbol_exports( ${name} ${EXPORTED_SYMBOL_FILE} )
endif()
if(SOURCEKITFW_MODULEMAP)
set(modulemap "${CMAKE_CURRENT_SOURCE_DIR}/${SOURCEKITFW_MODULEMAP}")
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
set(modules_dir "${framework_location}/Versions/A/Modules")
add_custom_command(TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${modulemap}" "${modules_dir}/module.modulemap"
COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Modules" "${framework_location}/Modules")
else()
set(modules_dir "${framework_location}/Modules")
add_custom_command(TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${modulemap}" "${modules_dir}/module.modulemap")
endif()
endif()
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
swift_install_in_component(${SOURCEKITFW_INSTALL_IN_COMPONENT}
TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
RUNTIME DESTINATION bin)
set_target_properties(${name} PROPERTIES FOLDER "SourceKit frameworks")
set_output_directory(${name}
BINARY_DIR ${SOURCEKIT_RUNTIME_OUTPUT_INTDIR}
LIBRARY_DIR ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
set_target_properties(${name} PROPERTIES FRAMEWORK TRUE)
set_target_properties(${name} PROPERTIES PUBLIC_HEADER "${headers}")
set_target_properties(${name} PROPERTIES MACOSX_FRAMEWORK_INFO_PLIST "${SOURCEKIT_SOURCE_DIR}/cmake/MacOSXFrameworkInfo.plist.in")
set_target_properties(${name} PROPERTIES MACOSX_FRAMEWORK_IDENTIFIER "com.apple.${name}")
set_target_properties(${name} PROPERTIES MACOSX_FRAMEWORK_SHORT_VERSION_STRING "1.0")
set_target_properties(${name} PROPERTIES MACOSX_FRAMEWORK_BUNDLE_VERSION "${SOURCEKIT_VERSION_STRING}")
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(${name} PROPERTIES INSTALL_NAME_DIR "@rpath")
else()
swift_install_in_component(${SOURCEKITFW_INSTALL_IN_COMPONENT}
DIRECTORY ${framework_location}
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
USE_SOURCE_PERMISSIONS)
set_target_properties(${name} PROPERTIES FOLDER "SourceKit frameworks")
set_output_directory(${name}
BINARY_DIR ${framework_location}
LIBRARY_DIR ${framework_location})
set_target_properties(${name} PROPERTIES PREFIX "")
set_target_properties(${name} PROPERTIES SUFFIX "")
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(${name} PROPERTIES INSTALL_NAME_DIR "@rpath/${name}.framework")
foreach(hdr ${headers})
get_filename_component(hdrname ${hdr} NAME)
add_custom_command(TARGET ${name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${hdr}" "${framework_location}/Headers/${hdrname}")
endforeach()
endif()
endmacro(add_sourcekit_framework)
# Add a new SourceKit XPC service to a framework.
#
# Usage:
# add_sourcekit_xpc_service(name # Name of the XPC service
# [DEPENDS dep1 ...] # Libraries this service depends on
# [COMPONENT_DEPENDS comp1 ...] # LLVM components this service depends on
# source1 [source2 source3 ...]) # Sources to add into this service
macro(add_sourcekit_xpc_service name framework_target)
cmake_parse_arguments(SOURCEKITXPC "" "" "DEPENDS;COMPONENT_DEPENDS" ${ARGN})
set(srcs ${SOURCEKITXPC_UNPARSED_ARGUMENTS})
set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
set(framework_location "${lib_dir}/${framework_target}.framework")
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
set(xpc_bundle_dir "${framework_location}/Versions/A/XPCServices/${name}.xpc")
set(xpc_contents_dir "${xpc_bundle_dir}/Contents")
set(xpc_bin_dir "${xpc_contents_dir}/MacOS")
else()
set(xpc_bundle_dir "${framework_location}/XPCServices/${name}.xpc")
set(xpc_contents_dir "${xpc_bundle_dir}")
set(xpc_bin_dir "${xpc_contents_dir}")
endif()
set(XPCSERVICE_NAME ${name})
set(XPCSERVICE_IDENTIFIER "com.apple.${name}")
set(XPCSERVICE_BUNDLE_VERSION "${SOURCEKIT_VERSION_STRING}")
set(XPCSERVICE_SHORT_VERSION_STRING "1.0")
configure_file(
"${SOURCEKIT_SOURCE_DIR}/cmake/XPCServiceInfo.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist")
add_custom_command(OUTPUT "${xpc_contents_dir}/Info.plist"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/${name}.Info.plist" "${xpc_contents_dir}/Info.plist")
list(APPEND srcs "${xpc_contents_dir}/Info.plist")
add_llvm_executable( ${name} ${srcs} )
set_target_properties(${name} PROPERTIES FOLDER "XPC Services")
set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${xpc_bin_dir}")
set_output_directory(${name}
BINARY_DIR "${xpc_bin_dir}"
LIBRARY_DIR "${xpc_bin_dir}")
# Add appropriate dependencies
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
target_link_libraries( ${name} ${SOURCEKITXPC_DEPENDS} )
swift_common_llvm_config( ${name} ${SOURCEKITXPC_COMPONENT_DEPENDS} )
target_link_libraries( ${name} ${LLVM_COMMON_LIBS} )
add_dependencies( ${framework_target} ${name} )
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
add_custom_command(TARGET ${name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/XPCServices" XPCServices
WORKING_DIRECTORY ${framework_location})
endif()
# ASan does not play well with exported_symbol option. This should be fixed soon.
if(NOT SWIFT_ASAN_BUILD)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set_target_properties(${name}
PROPERTIES
LINK_FLAGS "-Wl,-exported_symbol,_main")
endif()
endif()
endmacro()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# Choose an SDK if none was set.
set(MODULES_SDK "" CACHE PATH
"Path to the modules-enabled SDK to use")
if (NOT MODULES_SDK)
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path
OUTPUT_VARIABLE MODULES_SDK
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT EXISTS "${MODULES_SDK}/System/Library/Frameworks/module.map")
message(FATAL_ERROR "A modules-enabled SDK is required for SourceKit on OS X.")
endif()
# Choose a deployment target if none was set.
set(SOURCEKIT_DEPLOYMENT_TARGET "" CACHE STRING
"Deployment target for SourceKit.")
if (NOT SOURCEKIT_DEPLOYMENT_TARGET)
execute_process(COMMAND sw_vers -productVersion
OUTPUT_VARIABLE SOURCEKIT_DEPLOYMENT_TARGET
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+\\.[0-9]+" SOURCEKIT_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
endif()
# Choose a deployment OS if none was set.
set(SOURCEKIT_DEPLOYMENT_OS "macosx" CACHE STRING
"Deployment OS for SourceKit [macosx, iphoneos, iphonesimulator].")
# Sadly there are two OS naming conventions.
# xcrun SDK name: macosx iphoneos iphonesimulator (+ "internal" or version)
# -mOS-version-min: macosx ios ios-simulator
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^iphoneos")
set(version_min_os "ios")
set(triple_os "ios")
set(SOURCEKIT_DEFAULT_TARGET_SDK "IOS")
elseif (SOURCEKIT_DEPLOYMENT_OS MATCHES "^iphonesimulator")
set(version_min_os "ios-simulator")
set(triple_os "ios")
set(SOURCEKIT_DEFAULT_TARGET_SDK "IOS_SIMULATOR")
elseif (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
set(version_min_os "macosx")
set(triple_os "macosx")
set(SOURCEKIT_DEFAULT_TARGET_SDK "OSX")
else()
message(FATAL_ERROR "Can't understand SOURCEKIT_DEPLOYMENT_OS '${SOURCEKIT_DEPLOYMENT_OS}';")
endif()
# Determine deployment flags for the C/C++ compiler and linker.
set(SOURCEKIT_GLOBAL_DEPLOYMENT_TARGET_FLAGS
"-m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
# Add deployment target to C/C++ compiler and linker flags.
# FIXME: CMAKE_OSX_DEPLOYMENT_TARGET falls over when used for iOS versions.
if (XCODE)
if (${SOURCEKIT_DEPLOYMENT_OS} MATCHES "^macosx")
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
else()
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
endif()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
endif()
endif()
include_directories(BEFORE
${SOURCEKIT_BINARY_DIR}/include
${SOURCEKIT_SOURCE_DIR}/include
)
add_subdirectory(lib)
add_subdirectory(tools)