Skip to content

Commit 96d1864

Browse files
committed
[cmake] Fix some errors in the cmake code that enables LTO.
When I originally committed the LTO code, I tried to match the coding style of the code right above it that enabled code coverage. Turns out that the code coverage code did not have a weird coding style and instead just had a bug. I fixed both of the issues and also enabled the LTO flag on non-Darwin.
1 parent fbd74a3 commit 96d1864

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ function(_add_variant_c_compile_link_flags)
8989
"-F" "${SWIFT_SDK_${CFLAGS_SDK}_PATH}/../../../Developer/Library/Frameworks"
9090
"-m${SWIFT_SDK_${CFLAGS_SDK}_VERSION_MIN_NAME}-version-min=${DEPLOYMENT_VERSION}")
9191

92-
if(analyze_code_coverage)
92+
if(CFLAGS_ANALYZE_CODE_COVERAGE)
9393
list(APPEND result "-fprofile-instr-generate"
9494
"-fcoverage-mapping")
9595
endif()
96+
endif()
9697

97-
if(enable_lto)
98-
list(APPEND result "-flto")
99-
endif()
98+
if(CFLAGS_ENABLE_LTO)
99+
list(APPEND result "-flto")
100100
endif()
101101

102102
set("${CFLAGS_RESULT_VAR_NAME}" "${result}" PARENT_SCOPE)
@@ -117,7 +117,7 @@ function(_add_variant_c_compile_flags)
117117
ARCH "${CFLAGS_ARCH}"
118118
BUILD_TYPE "${CFLAGS_BUILD_TYPE}"
119119
ENABLE_ASSERTIONS "${CFLAGS_ENABLE_ASSERTIONS}"
120-
SWIFT_ENABLE_LTO "${SWIFT_ENABLE_LTO}"
120+
ENABLE_LTO "${SWIFT_ENABLE_LTO}"
121121
ANALYZE_CODE_COVERAGE FALSE
122122
DEPLOYMENT_VERSION_IOS "${CFLAGS_DEPLOYMENT_VERSION_IOS}"
123123
RESULT_VAR_NAME result)

0 commit comments

Comments
 (0)