Skip to content

Commit 3de52f4

Browse files
authored
Merge pull request #2985 from gottesmm/thinko_fix_update_unittests_to_use_compute_lto_flag
2 parents 3826628 + ee08987 commit 3de52f4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ function(_add_variant_c_compile_link_flags)
118118
endif()
119119
endif()
120120

121-
if(CFLAGS_ENABLE_LTO)
122-
_compute_lto_flag(${CFLAGS_ENABLE_LTO} _lto_flag_out)
121+
_compute_lto_flag("${CFLAGS_ENABLE_LTO}" _lto_flag_out)
122+
if (_lto_flag_out)
123123
list(APPEND result "${_lto_flag_out}")
124124
endif()
125125

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ function(add_swift_unittest test_dirname)
1515
#
1616
# *NOTE* The unittests are never built for the target, so we always enable LTO
1717
# *if we are asked to.
18-
if (SWIFT_TOOLS_ENABLE_LTO)
19-
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY COMPILE_FLAGS " -flto ")
20-
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY LINK_FLAGS " -flto ")
18+
_compute_lto_flag("${SWIFT_TOOLS_ENABLE_LTO}" _lto_flag_out)
19+
if (_lto_flag_out)
20+
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY COMPILE_FLAGS " ${_lto_flag_out} ")
21+
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY LINK_FLAGS " ${_lto_flag_out} ")
2122
endif()
2223

2324
if(SWIFT_BUILT_STANDALONE AND NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")

0 commit comments

Comments
 (0)