1 cmake_minimum_required(VERSION 3.3)
3 cmake_policy(SET CMP0126 NEW)
6 # NOTE: Force the Release mode configuration as there are some issues with the
7 # debug information handling on macOS on certain Xcode builds.
8 if(NOT CMAKE_CONFIGURATION_TYPES)
9 set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
12 # NOTE: enable shared libraries by default. Older Xcode releases do not play
13 # well with static libraries, and Windows does not currently support static
15 set(BUILD_SHARED_LIBS YES)
17 project(SwiftOnly Swift)
19 if(NOT XCODE_VERSION VERSION_LESS 10.2)
20 set(CMAKE_Swift_LANGUAGE_VERSION 5.0)
21 elseif(NOT XCODE_VERSION VERSION_LESS 8.0)
22 set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
25 set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
27 add_executable(SwiftOnly main.swift)
29 add_library(L L.swift)
31 add_library(M M.swift)
32 target_link_libraries(M PUBLIC
35 add_library(N N.swift)
36 target_link_libraries(N PUBLIC
39 # Dummy to make sure generation works with such targets.
40 add_library(SwiftIface INTERFACE)
41 target_link_libraries(SwiftOnly PRIVATE SwiftIface)