Skip to content

Commit 3ac17a0

Browse files
committed
Make force_lib.c --xcode specific.
1 parent 3dc815b commit 3ac17a0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,14 @@ function(add_swift_compiler_modules_library name)
171171
endforeach()
172172

173173
# Create a static library containing all module object files.
174-
add_library(${name} STATIC force_lib.c ${all_obj_files})
174+
if (XCODE)
175+
# Xcode does not compile libraries that contain only object files.
176+
# Therefore, it fails to create the static library. As a workaround,
177+
# we add an empty source file force_lib.c to the target.
178+
add_library(${name} STATIC force_lib.c ${all_obj_files})
179+
else()
180+
add_library(${name} STATIC ${all_obj_files})
181+
endif()
175182
add_dependencies(${name} ${all_module_targets})
176183
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
177184
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name})

SwiftCompilerSources/force_lib.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
/// Dummy source file to force CMake generated SwiftInTheCompiler.xcodeproj to sucessfully build static
14-
/// libraries containing only object fies for "bootstrap" process building Swift sources into compiler.
13+
/// Dummy source file to force CMake generated SwiftInTheCompiler.xcodeproj
14+
/// to sucessfully build static libraries conatining only object files for
15+
/// "bootstrap" process building Swift sources into compiler.

0 commit comments

Comments
 (0)