Skip to content

Commit 0e774ef

Browse files
committed
build: switch to bundled UUID
Rather than relying on the system UUID, use the bundled UUID on all the targets. There is some work needed to port this to windows, but this should be sufficient for Linux (and FreeBSD).
1 parent e241632 commit 0e774ef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ option(FOUNDATION_PATH_TO_XCTEST_BUILD "Path to XCTest build" "")
1919
find_package(CURL REQUIRED)
2020
find_package(ICU COMPONENTS uc i18n REQUIRED)
2121
find_package(LibXml2 REQUIRED)
22-
find_package(UUID REQUIRED)
2322

2423
include(SwiftSupport)
2524
include(GNUInstallDirs)
@@ -61,6 +60,9 @@ add_library(uuid
6160
STATIC
6261
uuid/uuid.h
6362
uuid/uuid.c)
63+
set_target_properties(uuid
64+
PROPERTIES
65+
POSITION_INDEPENDENT_CODE YES)
6466
# Add an include directory for the CoreFoundation framework headers to satisfy
6567
# the dependency on TargetConditionals.h
6668
target_compile_options(uuid
@@ -273,7 +275,8 @@ add_swift_library(Foundation
273275
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
274276
${LIBXML2_LIBRARIES}
275277
${libdispatch_ldflags}
276-
${uuid_LIBRARIES}
278+
-L${CMAKE_CURRENT_BINARY_DIR}
279+
-luuid
277280
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN"
278281
SWIFT_FLAGS
279282
-DDEPLOYMENT_RUNTIME_SWIFT
@@ -289,11 +292,12 @@ if(NOT BUILD_SHARED_LIBS)
289292
set(Foundation_INTERFACE_LIBRARIES
290293
-L${install_dir}/usr/lib
291294
-lCoreFoundation
295+
-L${CMAKE_CURRENT_BINARY_DIR}
296+
-luuid
292297
${CURL_LIBRARIES}
293298
${ICU_UC_LIBRARY}
294299
${ICU_I18N_LIBRARY}
295-
${LIBXML2_LIBRARIES}
296-
${uuid_LIBRARIES})
300+
${LIBXML2_LIBRARIES})
297301
endif()
298302

299303
add_swift_executable(plutil
@@ -304,8 +308,8 @@ add_swift_executable(plutil
304308
${deployment_enable_libdispatch}
305309
-F${install_dir}/System/Library/Frameworks
306310
LINK_FLAGS
307-
-L${CMAKE_CURRENT_BINARY_DIR}
308311
${libdispatch_ldflags}
312+
-L${CMAKE_CURRENT_BINARY_DIR}
309313
-lFoundation
310314
${Foundation_INTERFACE_LIBRARIES}
311315
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN/../lib/swift/${swift_os}"
@@ -318,6 +322,7 @@ add_swift_executable(plutil
318322
${swift_enable_testing}
319323
${swift_optimization_flags}
320324
DEPENDS
325+
uuid
321326
Foundation
322327
CoreFoundation)
323328

@@ -339,6 +344,7 @@ if(ENABLE_TESTING)
339344
-I;${ICU_INCLUDE_DIR}
340345
${libdispatch_cflags}
341346
DEPENDS
347+
uuid
342348
Foundation
343349
CoreFoundation)
344350

0 commit comments

Comments
 (0)