Skip to content

Commit 3ede5a0

Browse files
committed
[CMake] Add option to specify '-module-abi-name'
Add 'SWIFT_MODULE_ABI_NAME_PREFIX' CMake variable. This can be used from compiler's CMake so its swift-syntax libraries can have unique names. That avoids symbol name conflicts when compiler libraries (e.g. sourcekitdInProc) is used from binaries linking with swift-syntax (e.g. via SwiftPM) swiftlang/swift#68812 rdar://116951101 (cherry picked from commit 093b895) (cherry picked from commit d8c8695)
1 parent d3fe9e7 commit 3ede5a0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ function(add_swift_host_library name)
5454
-emit-module-path;${module_file};
5555
-emit-module-source-info-path;${module_sourceinfo_file};
5656
-emit-module-interface-path;${module_interface_file}
57+
>)
58+
if(SWIFT_MODULE_ABI_NAME_PREFIX)
59+
# ABI name prefix. this can be used to avoid name conflicts.
60+
target_compile_options("${name}" PRIVATE
61+
$<$<COMPILE_LANGUAGE:Swift>:
62+
"SHELL:-Xfrontend -module-abi-name"
63+
"SHELL:-Xfrontend ${SWIFT_MODULE_ABI_NAME_PREFIX}${name}"
5764
>)
65+
endif()
5866

5967
# NOTE: workaround for CMake not setting up include flags yet
6068
set_target_properties(${name} PROPERTIES

0 commit comments

Comments
 (0)