File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -171,19 +171,16 @@ function(add_swift_compiler_modules_library name)
171171 endforeach ()
172172
173173 # Create a static library containing all module object 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+ set (all_obj_files force_lib.c ${all_obj_files} )
179+ endif ()
174180 add_library (${name} STATIC ${all_obj_files} )
175181 add_dependencies (${name} ${all_module_targets} )
176182 set_target_properties (${name} PROPERTIES LINKER_LANGUAGE CXX)
177183 set_property (GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name} )
178-
179- # Xcode does not compile libraries that contain only object files.
180- # Therefore, it fails to create the static library. As a workaround,
181- # we add a dummy script phase to the target.
182- if (XCODE)
183- add_custom_command (TARGET ${name} POST_BUILD
184- COMMAND ""
185- COMMENT "Dummy script phase to force building this target" )
186- endif ()
187184endfunction ()
188185
189186
Original file line number Diff line number Diff line change 1+ //===--- force_lib.c ------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ //===----------------------------------------------------------------------===//
12+
13+ /// Dummy source file to force CMake generated SwiftInTheCompiler.xcodeproj
14+ /// to sucessfully build static libraries conatining only object files used
15+ /// during "bootstrap" process to link Swift sources into the compiler.
You can’t perform that action at this time.
0 commit comments