Files
cmake/Tests/RunCMake/Swift/SwiftModuleNameHyphen.cmake
Roman Lavrov 933c59ffde Swift: Replace hyphens with underscores in default module name
GetSwiftModuleName() returns the target name verbatim when
Swift_MODULE_NAME is not set, but hyphens are not valid in Swift
module identifiers.  Replace them with underscores so that targets
like swift-syntax get module name swift_syntax automatically.

Issue: #27748
2026-04-27 19:21:29 -04:00

12 lines
358 B
CMake

cmake_policy(SET CMP0157 NEW)
if(NOT CMAKE_GENERATOR MATCHES "Ninja")
message(SEND_ERROR "this test must use a Ninja generator, found ${CMAKE_GENERATOR}")
endif()
enable_language(Swift)
# A target with hyphens in the name. Swift module names cannot contain
# hyphens, so CMake should replace them with underscores.
add_library(L-hyphen STATIC L.swift)