Skip to content

Commit d64e7d8

Browse files
committed
build: install CoreFoundation libraries for static builds
The static builds have dependencies on CoreFoundation which need to be resolved when linking (not all platforms provide relocatable linking). Install the CoreFoundation libraries during static builds.
1 parent 0b77b0f commit d64e7d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ if(ENABLE_TESTING)
6060
add_subdirectory(TestFoundation)
6161
endif()
6262

63-
add_subdirectory(cmake/modules)
64-
63+
if(NOT BUILD_SHARED_LIBS)
64+
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
65+
CoreFoundation CFXMLInterface CFURLSessionInterface)
66+
install(TARGETS CoreFoundation CXFXMLInterface CFURLSessionInterface
67+
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
68+
endif()
6569
# TODO(compnerd) install as a Framework as that is how swift actually is built
6670
install(DIRECTORY
6771
${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers/
@@ -90,3 +94,5 @@ install(FILES
9094
CoreFoundation/Parsing.subproj/module.map
9195
DESTINATION
9296
lib/swift/CFXMLInterface)
97+
98+
add_subdirectory(cmake/modules)

0 commit comments

Comments
 (0)