Skip to content

Commit 970c059

Browse files
committed
build: simplify check using the SDK OBJECT_FORMAT
_OBJECT_FORMAT was added recentlyish for all the SDKs. Use that property rather than enumerating all the ELFish targets. This ensures that the code path is correct if another ELFish target is ported to.
1 parent 1886b4a commit 970c059

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,20 +578,16 @@ function(_add_swift_library_single target name)
578578
set(SWIFTLIB_SINGLE_API_NOTES "${module_name}")
579579
endif()
580580

581-
# On platforms that use ELF binaries (for now that is Linux and FreeBSD)
582-
# we add markers for metadata sections in the shared libraries using
583-
# these object files. This wouldn't be necessary if the link was done by
584-
# the swift binary: rdar://problem/19007002
585-
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "LINUX" OR
586-
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "FREEBSD")
587-
581+
# On platforms that use ELF binaries we add markers for metadata sections in
582+
# the shared libraries using these object files. This wouldn't be necessary
583+
# if the link was done by the swift binary: rdar://problem/19007002
584+
if("${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
588585
if("${libkind}" STREQUAL "SHARED")
589586
set(arch_subdir "${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR}")
590587

591588
set(SWIFT_SECTIONS_OBJECT_BEGIN "${arch_subdir}/swift_begin.o")
592589
set(SWIFT_SECTIONS_OBJECT_END "${arch_subdir}/swift_end.o")
593590
endif()
594-
595591
endif()
596592

597593
# FIXME: don't actually depend on the libraries in SWIFTLIB_SINGLE_LINK_LIBRARIES,

0 commit comments

Comments
 (0)