diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b2cf7ad094..928f3a2b8a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ if(CMAKE_VERSION VERSION_LESS 3.21) endif() endif() +set(SWIFT_MODULE_ABI_NAME_PREFIX CACHE STRING "ABI name prefix to avoid name conflicts") + # The subdirectory into which host libraries will be installed. set(SWIFT_HOST_LIBRARIES_SUBDIRECTORY "swift/host") diff --git a/cmake/modules/AddSwiftHostLibrary.cmake b/cmake/modules/AddSwiftHostLibrary.cmake index 7a4d22e47d7..e8e6e4c717b 100644 --- a/cmake/modules/AddSwiftHostLibrary.cmake +++ b/cmake/modules/AddSwiftHostLibrary.cmake @@ -77,7 +77,14 @@ function(add_swift_syntax_library name) -emit-module-path;${module_file}; -emit-module-source-info-path;${module_sourceinfo_file}; -emit-module-interface-path;${module_interface_file} + >) + if(SWIFT_MODULE_ABI_NAME_PREFIX) + target_compile_options("${name}" PRIVATE + $<$: + "SHELL:-Xfrontend -module-abi-name" + "SHELL:-Xfrontend ${SWIFT_MODULE_ABI_NAME_PREFIX}${name}" >) + endif() if(CMAKE_VERSION VERSION_LESS 3.26.0 AND SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26) target_compile_options(${name} PRIVATE