Merge topic 'xcode-swift-version'
b35568f3
Xcode: Add option to set Swift language version49d50ad4
Xcode: Port rudimentary Swift support to Xcode 8
This commit is contained in:
commit
c6f07d06c6
|
@ -396,6 +396,7 @@ Variables for Languages
|
||||||
/variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
|
/variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
|
||||||
/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
|
/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
|
||||||
/variable/CMAKE_LANG_STANDARD_LIBRARIES
|
/variable/CMAKE_LANG_STANDARD_LIBRARIES
|
||||||
|
/variable/CMAKE_Swift_LANGUAGE_VERSION
|
||||||
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
|
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
|
||||||
|
|
||||||
Variables for CTest
|
Variables for CTest
|
||||||
|
|
|
@ -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.
|
|
@ -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.
|
|
@ -266,6 +266,11 @@ Id flags: ${testflags}
|
||||||
else()
|
else()
|
||||||
set(id_toolset "")
|
set(id_toolset "")
|
||||||
endif()
|
endif()
|
||||||
|
if("${lang}" STREQUAL "Swift")
|
||||||
|
set(id_lang_version "SWIFT_VERSION = 2.3;")
|
||||||
|
else()
|
||||||
|
set(id_lang_version "")
|
||||||
|
endif()
|
||||||
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
set(id_deployment_target
|
set(id_deployment_target
|
||||||
"MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
|
"MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
|
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
|
||||||
SYMROOT = .;
|
SYMROOT = .;
|
||||||
@id_toolset@
|
@id_toolset@
|
||||||
|
@id_lang_version@
|
||||||
@id_deployment_target@
|
@id_deployment_target@
|
||||||
@id_sdkroot@
|
@id_sdkroot@
|
||||||
};
|
};
|
||||||
|
|
|
@ -2996,6 +2996,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
||||||
buildSettings->AddAttribute("GCC_VERSION",
|
buildSettings->AddAttribute("GCC_VERSION",
|
||||||
this->CreateString(this->GeneratorToolset));
|
this->CreateString(this->GeneratorToolset));
|
||||||
}
|
}
|
||||||
|
if (this->GetLanguageEnabled("Swift")) {
|
||||||
|
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();
|
std::string symroot = root->GetCurrentBinaryDirectory();
|
||||||
symroot += "/build";
|
symroot += "/build";
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.3)
|
||||||
project(SwiftOnly Swift)
|
project(SwiftOnly Swift)
|
||||||
|
|
||||||
|
if(NOT XCODE_VERSION VERSION_LESS 8.0)
|
||||||
|
set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(SwiftOnly main.swift)
|
add_executable(SwiftOnly main.swift)
|
||||||
|
|
Loading…
Reference in New Issue