Skip to content

Commit 9822504

Browse files
authored
Merge pull request #2288 from rintaro/5.10-cmake-abi-name-rdar116951101
[5.10][CMake] Add option to specify '-module-abi-name'
2 parents f995a62 + 69f5db1 commit 9822504

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ if(CMAKE_VERSION VERSION_LESS 3.21)
2222
endif()
2323
endif()
2424

25+
set(SWIFT_MODULE_ABI_NAME_PREFIX CACHE STRING "ABI name prefix to avoid name conflicts")
26+
2527
# The subdirectory into which host libraries will be installed.
2628
set(SWIFT_HOST_LIBRARIES_SUBDIRECTORY "swift/host")
2729

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ function(add_swift_syntax_library name)
7777
-emit-module-path;${module_file};
7878
-emit-module-source-info-path;${module_sourceinfo_file};
7979
-emit-module-interface-path;${module_interface_file}
80+
>)
81+
if(SWIFT_MODULE_ABI_NAME_PREFIX)
82+
target_compile_options("${name}" PRIVATE
83+
$<$<COMPILE_LANGUAGE:Swift>:
84+
"SHELL:-Xfrontend -module-abi-name"
85+
"SHELL:-Xfrontend ${SWIFT_MODULE_ABI_NAME_PREFIX}${name}"
8086
>)
87+
endif()
8188

8289
if(CMAKE_VERSION VERSION_LESS 3.26.0 AND SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26)
8390
target_compile_options(${name} PRIVATE

0 commit comments

Comments
 (0)