@@ -19,7 +19,6 @@ option(FOUNDATION_PATH_TO_XCTEST_BUILD "Path to XCTest build" "")
19
19
find_package (CURL REQUIRED )
20
20
find_package (ICU COMPONENTS uc i18n REQUIRED )
21
21
find_package (LibXml2 REQUIRED )
22
- find_package (UUID REQUIRED )
23
22
24
23
include (SwiftSupport )
25
24
include (GNUInstallDirs )
@@ -57,6 +56,27 @@ ExternalProject_Add(CoreFoundation
57
56
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --target install )
58
57
ExternalProject_Get_Property (CoreFoundation install_dir )
59
58
59
+ add_library (uuid
60
+ STATIC
61
+ uuid/uuid.h
62
+ uuid/uuid.c )
63
+ set_target_properties (uuid
64
+ PROPERTIES
65
+ POSITION_INDEPENDENT_CODE YES )
66
+ # Add an include directory for the CoreFoundation framework headers to satisfy
67
+ # the dependency on TargetConditionals.h
68
+ target_compile_options (uuid
69
+ PUBLIC
70
+ -I${install_dir}/System/Library/Frameworks/CoreFoundation.framework/Headers )
71
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows )
72
+ target_compile_definitions (uuid
73
+ PRIVATE
74
+ _CRT_NONSTDC_NO_WARNINGS
75
+ _CRT_SECURE_NO_DEPRECATE
76
+ _CRT_SECURE_NO_WARNINGS )
77
+ endif ()
78
+ add_dependencies (uuid CoreFoundation )
79
+
60
80
set (swift_optimization_flags )
61
81
if (CMAKE_BUILD_TYPE MATCHES Release )
62
82
set (swift_optimization_flags -O )
@@ -262,7 +282,8 @@ add_swift_library(Foundation
262
282
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
263
283
${LIBXML2_LIBRARIES}
264
284
${libdispatch_ldflags}
265
- ${uuid_LIBRARIES}
285
+ -L${CMAKE_CURRENT_BINARY_DIR}
286
+ -luuid
266
287
-Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN"
267
288
SWIFT_FLAGS
268
289
-DDEPLOYMENT_RUNTIME_SWIFT
@@ -278,11 +299,12 @@ if(NOT BUILD_SHARED_LIBS)
278
299
set (Foundation_INTERFACE_LIBRARIES
279
300
-L${install_dir}/usr/lib
280
301
-lCoreFoundation
302
+ -L${CMAKE_CURRENT_BINARY_DIR}
303
+ -luuid
281
304
${CURL_LIBRARIES}
282
305
${ICU_UC_LIBRARY}
283
306
${ICU_I18N_LIBRARY}
284
- ${LIBXML2_LIBRARIES}
285
- ${uuid_LIBRARIES} )
307
+ ${LIBXML2_LIBRARIES} )
286
308
endif ()
287
309
288
310
add_swift_executable (plutil
@@ -293,8 +315,8 @@ add_swift_executable(plutil
293
315
${deployment_enable_libdispatch}
294
316
-F${install_dir}/System/Library/Frameworks
295
317
LINK_FLAGS
296
- -L${CMAKE_CURRENT_BINARY_DIR}
297
318
${libdispatch_ldflags}
319
+ -L${CMAKE_CURRENT_BINARY_DIR}
298
320
-lFoundation
299
321
${Foundation_INTERFACE_LIBRARIES}
300
322
-Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN/../lib/swift/${swift_os} "
@@ -307,6 +329,7 @@ add_swift_executable(plutil
307
329
${swift_enable_testing}
308
330
${swift_optimization_flags}
309
331
DEPENDS
332
+ uuid
310
333
Foundation
311
334
CoreFoundation )
312
335
@@ -328,6 +351,7 @@ if(ENABLE_TESTING)
328
351
-I;${ICU_INCLUDE_DIR}
329
352
${libdispatch_cflags}
330
353
DEPENDS
354
+ uuid
331
355
Foundation
332
356
CoreFoundation )
333
357
0 commit comments