summaryrefslogtreecommitdiffstats
path: root/Tests/SwiftOnly
diff options
context:
space:
mode:
authorDavid Geldreich <david.geldreich@free.fr>2022-06-19 20:55:09 (GMT)
committerDavid Geldreich <david.geldreich@free.fr>2022-07-07 13:00:32 (GMT)
commit5cb625eb2f7908d1c07e5bd2820263d97449ee79 (patch)
treea2b0c91db5795328ef298b78c50a8886c34f8a6f /Tests/SwiftOnly
parent15f4ee89fe2f140266801dfbfabb5ba0fcff8bf7 (diff)
downloadCMake-5cb625eb2f7908d1c07e5bd2820263d97449ee79.zip
CMake-5cb625eb2f7908d1c07e5bd2820263d97449ee79.tar.gz
CMake-5cb625eb2f7908d1c07e5bd2820263d97449ee79.tar.bz2
Xcode: Pass compile definitions to Swift
correct Xcode generator Swift definitions original code was defining GCC_PREPROCESSOR_DEFINITIONS which is valid only for C languages add definitions to SWIFT_ACTIVE_COMPILATION_CONDITIONS when Swift language is used in the target add test in SwiftOnly for old Xcode (<8.0), append defines to cflags so it ends up in OTHER_SWIFT_FLAGS Fixes: #23637
Diffstat (limited to 'Tests/SwiftOnly')
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt1
-rw-r--r--Tests/SwiftOnly/main.swift6
2 files changed, 7 insertions, 0 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 01c2222..e92e544 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -25,6 +25,7 @@ endif()
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
add_executable(SwiftOnly main.swift)
+target_compile_definitions(SwiftOnly PRIVATE SWIFTONLY)
add_library(L L.swift)
diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift
index 28560d0..a3f1a2c 100644
--- a/Tests/SwiftOnly/main.swift
+++ b/Tests/SwiftOnly/main.swift
@@ -1 +1,7 @@
dump("SwiftOnly")
+
+#if SWIFTONLY
+dump("SWIFTONLY defined")
+#else
+fatalError("SWIFTONLY NOT defined")
+#endif