summaryrefslogtreecommitdiffstats
path: root/Tests/SwiftMixLib
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2022-10-26 23:11:51 (GMT)
committerEvan Wilde <etceterawilde@gmail.com>2022-10-28 23:44:26 (GMT)
commite88509d0e87eaa6f41603bfd7b07b653527e88c0 (patch)
treeb7d43db0ee99bc1a1a7d79640d434725820d949c /Tests/SwiftMixLib
parentbcf203226a6877824b91f2ffa9b5cc0373900273 (diff)
downloadCMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.zip
CMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.tar.gz
CMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.tar.bz2
Swift: Omit output-file-map when used as a linker
Swift is used as the linker for non-swift files because it needs to pull files like swiftrt.o in when swift symbols are present to ensure that the swift runtime is linked. The swift driver uses clang as the underlying linker, which pulls in crtbegin.o and friends when appropriate, so using Swift as a linker for C/C++ libraries is fine. The output-file-map was getting passed to all Swift invocations, regardless of whether or not we generated one. This patch changes it so that we only include the output-file-map in the Swift compiler invocation if we have actually generated the file.
Diffstat (limited to 'Tests/SwiftMixLib')
-rw-r--r--Tests/SwiftMixLib/CMakeLists.txt3
-rw-r--r--Tests/SwiftMixLib/main.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/Tests/SwiftMixLib/CMakeLists.txt b/Tests/SwiftMixLib/CMakeLists.txt
index 40d3498..a52fc94 100644
--- a/Tests/SwiftMixLib/CMakeLists.txt
+++ b/Tests/SwiftMixLib/CMakeLists.txt
@@ -4,3 +4,6 @@ project(SwiftMixLib C CXX Swift)
add_library(SwiftMixedLib lib.c lib.cpp lib.swift)
add_executable(Swifty main.swift)
target_link_libraries(Swifty PUBLIC SwiftMixedLib)
+
+add_executable(c_main main.c)
+target_link_libraries(c_main PUBLIC SwiftMixedLib)
diff --git a/Tests/SwiftMixLib/main.c b/Tests/SwiftMixLib/main.c
new file mode 100644
index 0000000..6ecf984
--- /dev/null
+++ b/Tests/SwiftMixLib/main.c
@@ -0,0 +1,3 @@
+int main(int argc, char* argv[])
+{
+}