Skip to content

Commit 0c1d8a6

Browse files
committed
[cmake] Enable cross-module-optimization when compiling swift libraries in release/relwithdebinfo.
1 parent bc6dbd4 commit 0c1d8a6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,11 @@ function(add_swift_host_library name)
527527
endif()
528528
endif()
529529
530+
# If we are compiling in release or release with deb info, compile swift code
531+
# with -cross-module-optimization enabled.
532+
target_compile_options(${name} PRIVATE
533+
$<$<AND:$<COMPILE_LANGUAGE:Swift>,$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>>:-cross-module-optimization>)
534+
530535
add_dependencies(dev ${name})
531536
if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
532537
swift_install_in_component(TARGETS ${name}

0 commit comments

Comments
 (0)