mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Adding checks to ensure that CMP0195 has the desired effect. If the Swift compiler is too old and does not include the module triple in the emitted target info, we won't set `CMAKE_Swift_MODULE_TRIPLE` and end up with the flat directory structure. In this case, these tests won't have the expected layout. Issue: #28021
23 lines
653 B
CMake
23 lines
653 B
CMake
cmake_minimum_required(VERSION 4.0)
|
|
|
|
cmake_policy(SET CMP0157 NEW)
|
|
cmake_policy(SET CMP0195 NEW)
|
|
cmake_policy(SET CMP0215 NEW)
|
|
|
|
if(NOT CMAKE_GENERATOR MATCHES "Ninja")
|
|
message(SEND_ERROR "this test must use a Ninja generator, found ${CMAKE_GENERATOR}")
|
|
endif()
|
|
|
|
enable_language(Swift)
|
|
|
|
# Older Swift compilers may not set CMAKE_Swift_MODULE_TRIPLE
|
|
# Don't build anything if we can't do the nested module structure
|
|
if(NOT CMAKE_Swift_MODULE_TRIPLE)
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/no-swift-module-triple" "")
|
|
return()
|
|
endif()
|
|
|
|
add_library(L STATIC L.swift)
|
|
add_library(LClient STATIC LClient.swift)
|
|
target_link_libraries(LClient PRIVATE L)
|