[Cmake-commits] CMake branch, next, updated. v3.6.2-2433-gb09e900
Brad King
brad.king at kitware.com
Fri Sep 23 13:34:23 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via b09e900006ba1960ce16f09b73767b9d3a2a171b (commit)
via 0c95231744091d1bcd430cd263374ca90db9efe8 (commit)
via 49d50ad40719722236c7867bd69e7ab414224c49 (commit)
from 9c066f0082a2b4cb35e668cd7262cba6d65d21fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b09e900006ba1960ce16f09b73767b9d3a2a171b
commit b09e900006ba1960ce16f09b73767b9d3a2a171b
Merge: 9c066f0 0c95231
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 23 13:34:21 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Sep 23 13:34:21 2016 -0400
Merge topic 'xcode-swift-version' into next
0c952317 Xcode: Add option to set Swift language version
49d50ad4 Xcode: Port rudimentary Swift support to Xcode 8
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c95231744091d1bcd430cd263374ca90db9efe8
commit 0c95231744091d1bcd430cd263374ca90db9efe8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 23 13:25:35 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Sep 23 13:33:36 2016 -0400
Xcode: Add option to set Swift language version
Create a new CMAKE_Swift_LANGUAGE_VERSION variable to specify the
SWIFT_VERSION attribute in a generated Xcode project. Ideally this
would be a `<LANG>_STANDARD` property but since Swift support is
very minimal we should reserve that property for more complete
treatment later.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 9e0efe9..d9da3d6 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -396,6 +396,7 @@ Variables for Languages
/variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
/variable/CMAKE_LANG_STANDARD_LIBRARIES
+ /variable/CMAKE_Swift_LANGUAGE_VERSION
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
Variables for CTest
diff --git a/Help/release/dev/xcode-swift-version.rst b/Help/release/dev/xcode-swift-version.rst
new file mode 100644
index 0000000..5dff23c
--- /dev/null
+++ b/Help/release/dev/xcode-swift-version.rst
@@ -0,0 +1,6 @@
+xcode-swift-version
+-------------------
+
+* The :generator:`Xcode` generator's rudimentary Swift language support
+ learned to honor a new :variable:`CMAKE_Swift_LANGUAGE_VERSION` variable
+ to tell Xcode what version of Swift is used by the source.
diff --git a/Help/variable/CMAKE_Swift_LANGUAGE_VERSION.rst b/Help/variable/CMAKE_Swift_LANGUAGE_VERSION.rst
new file mode 100644
index 0000000..50121e2
--- /dev/null
+++ b/Help/variable/CMAKE_Swift_LANGUAGE_VERSION.rst
@@ -0,0 +1,5 @@
+CMAKE_Swift_LANGUAGE_VERSION
+----------------------------
+
+Set to the Swift language version number. If not set, the legacy "2.3"
+version is assumed.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 42d97db..0d5de06 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2997,7 +2997,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateString(this->GeneratorToolset));
}
if (this->GetLanguageEnabled("Swift")) {
- buildSettings->AddAttribute("SWIFT_VERSION", this->CreateString("2.3"));
+ std::string swiftVersion = "2.3";
+ if (const char* vers = this->CurrentMakefile->GetDefinition(
+ "CMAKE_Swift_LANGUAGE_VERSION")) {
+ swiftVersion = vers;
+ }
+ buildSettings->AddAttribute("SWIFT_VERSION",
+ this->CreateString(swiftVersion));
}
std::string symroot = root->GetCurrentBinaryDirectory();
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 5cb9739..cf4463c 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(SwiftOnly Swift)
+if(NOT XCODE_VERSION VERSION_LESS 8.0)
+ set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
+endif()
+
add_executable(SwiftOnly main.swift)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49d50ad40719722236c7867bd69e7ab414224c49
commit 49d50ad40719722236c7867bd69e7ab414224c49
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 23 11:43:08 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Sep 23 11:47:06 2016 -0400
Xcode: Port rudimentary Swift support to Xcode 8
The `.pbxproj` file must now specify a `SWIFT_VERSION` value.
Set it to the legacy value of "2.3" for now. Later this can
be made configurable (e.g. to "3.0").
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 64d9bed..3d1ca6d 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -266,6 +266,11 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
+ if("${lang}" STREQUAL "Swift")
+ set(id_lang_version "SWIFT_VERSION = 2.3;")
+ else()
+ set(id_lang_version "")
+ endif()
if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(id_deployment_target
"MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 20f3da3..22ad4f6 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -84,6 +84,7 @@
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
@id_toolset@
+ @id_lang_version@
@id_deployment_target@
@id_sdkroot@
};
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 997f46c..42d97db 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2996,6 +2996,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
buildSettings->AddAttribute("GCC_VERSION",
this->CreateString(this->GeneratorToolset));
}
+ if (this->GetLanguageEnabled("Swift")) {
+ buildSettings->AddAttribute("SWIFT_VERSION", this->CreateString("2.3"));
+ }
std::string symroot = root->GetCurrentBinaryDirectory();
symroot += "/build";
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-variables.7.rst | 1 +
Help/release/dev/xcode-swift-version.rst | 6 ++++++
Help/variable/CMAKE_Swift_LANGUAGE_VERSION.rst | 5 +++++
Modules/CMakeDetermineCompilerId.cmake | 5 +++++
Modules/CompilerId/Xcode-3.pbxproj.in | 1 +
Source/cmGlobalXCodeGenerator.cxx | 9 +++++++++
Tests/SwiftOnly/CMakeLists.txt | 4 ++++
7 files changed, 31 insertions(+)
create mode 100644 Help/release/dev/xcode-swift-version.rst
create mode 100644 Help/variable/CMAKE_Swift_LANGUAGE_VERSION.rst
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list