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 add_subdirectory(SubA)
26 add_subdirectory(SubB)
28 set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
30 add_executable(SwiftOnly main.swift)
31 target_compile_definitions(SwiftOnly PRIVATE SWIFTONLY)
33 add_library(L L.swift)
35 add_library(M M.swift)
36 target_link_libraries(M PUBLIC
39 add_library(N N.swift)
40 target_link_libraries(N PUBLIC
43 # Dummy to make sure generation works with such targets.
44 add_library(SwiftIface INTERFACE)
45 target_link_libraries(SwiftOnly PRIVATE SwiftIface)