Skip to content

Commit 7a9df99

Browse files
authored
Merge pull request #496 from al45tair/eng/PR-130582882
[Linux] Enable build IDs.
2 parents 2a8fe20 + 9512507 commit 7a9df99

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ endif()
2323

2424
include(SwiftSupport)
2525
include(GNUInstallDirs)
26+
include(CheckLinkerFlag)
27+
28+
if(CMAKE_SYSTEM_NAME STREQUAL Linux
29+
OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD
30+
OR CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
31+
enable_language(C)
32+
check_linker_flag(C "LINKER:--build-id=sha1" LINKER_SUPPORTS_BUILD_ID)
33+
endif()
2634

2735
add_library(XCTest
2836
Sources/XCTest/Private/WallClockTimeMetric.swift
@@ -79,6 +87,10 @@ set_target_properties(XCTest PROPERTIES
7987
Swift_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swift
8088
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/swift)
8189

90+
if(LINKER_SUPPORTS_BUILD_ID)
91+
target_link_options(XCTest PRIVATE "LINKER:--build-id=sha1")
92+
endif()
93+
8294

8395
if(ENABLE_TESTING)
8496
enable_testing()

0 commit comments

Comments
 (0)