summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenerateExportHeader/reference
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2022-12-31 07:41:16 (GMT)
committerEvan Wilde <etceterawilde@gmail.com>2023-01-19 19:49:24 (GMT)
commit4165eb3d0b21601977b26e8f8af5193c55169cee (patch)
treedefffcae770b9328019490df5135b1df81b20364 /Tests/RunCMake/GenerateExportHeader/reference
parent06dfd7b7054aa8d78d736c2e5d84f6f873dd48e3 (diff)
downloadCMake-4165eb3d0b21601977b26e8f8af5193c55169cee.zip
CMake-4165eb3d0b21601977b26e8f8af5193c55169cee.tar.gz
CMake-4165eb3d0b21601977b26e8f8af5193c55169cee.tar.bz2
Ninja: Emit swiftmodule from executable with exports
This patch adds support for tracking the swiftmodules for executables exporting symbols. This fixes a bug in the earlier implementation around emitting the swiftmodule. Previously, the code would use `CMAKE_EXE_EXPORTS_Swift_FLAG` to inject the `-emit-module`, and module path information into the `CMAKE_Swift_LINK_EXECUTABLE` rule. Because Swift skips the build step and only runs during the link phase, these flags were injected in `cmNinjaNormalTargetGenerator::ComputeLinkCmd` instead of `cmLocalGenerator::GetTargetFlags` where it is done normally. Unfortunately, injecting in `ComputeLinkCmd` didn't do anything because we have a `linkCmd` so `ComputeLinkCmd` exits early, before the EXE_EXPORT flags get added to the link command. Instead of playing with that flag, CMake checks `CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS` and uses that as the link rule if it exists and falls back on `CMAKE_Swift_LINK_EXECUTABLE`. I've defined that variable in terms of `CMAKE_Swift_LINK_EXECUTABLE` with the necessary additional flags for emitting the swift module instead. This has the same end effect as the desired behavior, but simplifies things a bit. Since we're generating the swiftmodule for executables with exports, I've also updated the dependency graph to include the swiftmodule as an output in the build dependency graph if the executable has exports. Tests updated: - RunCMake/NoWorkToDo: Ensure that the build graph does not result in unnecessary rebuilds with exporting executables. - SwiftOnly: Ensure that we can consume functions defined in the executable by a library getting linked into said executable.
Diffstat (limited to 'Tests/RunCMake/GenerateExportHeader/reference')
0 files changed, 0 insertions, 0 deletions