forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoldVersion.cmake
18 lines (18 loc) · 697 Bytes
/
GoldVersion.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Find the version of ld.gold, if installed.
#
# Versions prior to 2.36 break Swift programs because they won't coalesce
# sections with different SHF_GNU_RETAIN flags.
function(get_gold_version result_var_name)
find_program(gold_executable "ld.gold")
if(gold_executable)
execute_process(
COMMAND"${gold_executable}""--version"
COMMAND"head""-n""1"
COMMAND"sed""-e""s/^.* (\\([^)]*\\)).*$/\\1/g;s/.* \\([0-9][0-9]*\\(\\.[0-9][0-9]*\\)*\\).*/\\1/g"
OUTPUT_VARIABLE gold_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
set("${result_var_name}""${gold_version}" PARENT_SCOPE)
else()
set("${result_var_name}""" PARENT_SCOPE)
endif()
endfunction()