diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2017-03-28 14:04:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-28 20:06:29 (GMT) |
commit | c03141c04cededf6bf31d51627cd8b29c7668495 (patch) | |
tree | f88d4db6f9fc50eae5a25f64bb67f1e78eb1dc2a /Modules | |
parent | 1adbe223cd10ee133f5137da028ed86ddef7cc4d (diff) | |
download | CMake-c03141c04cededf6bf31d51627cd8b29c7668495.zip CMake-c03141c04cededf6bf31d51627cd8b29c7668495.tar.gz CMake-c03141c04cededf6bf31d51627cd8b29c7668495.tar.bz2 |
Swift: Default to Swift 3.0 with Xcode 8.3 and later
Xcode 8.3 has dropped support for Swift 2.3 so that compiler and
feature detection failed.
Closes #16742
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index bb34de5..c41a986 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -269,7 +269,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_toolset "") endif() if("${lang}" STREQUAL "Swift") - set(id_lang_version "SWIFT_VERSION = 2.3;") + if(CMAKE_Swift_LANGUAGE_VERSION) + set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};") + elseif(XCODE_VERSION VERSION_GREATER_EQUAL 8.3) + set(id_lang_version "SWIFT_VERSION = 3.0;") + else() + set(id_lang_version "SWIFT_VERSION = 2.3;") + endif() else() set(id_lang_version "") endif() |