summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-08-12 01:36:06 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-26 15:38:40 (GMT)
commit369c48ee437263a9702c8725f6e73bc4b9d0fe16 (patch)
tree94b7e3194e2d3448d328f197a1d5c61d6a8e6a07 /Source
parent19612dffd27d90d73e3b7cff9cbba241294c17e9 (diff)
downloadCMake-369c48ee437263a9702c8725f6e73bc4b9d0fe16.zip
CMake-369c48ee437263a9702c8725f6e73bc4b9d0fe16.tar.gz
CMake-369c48ee437263a9702c8725f6e73bc4b9d0fe16.tar.bz2
Swift: honour `-swift-version` in Ninja generator
Swift has supported `CMAKE_Swift_LANGUAGE_VERSION` and `Swift_LANGUAGE_VERSION` but didn't apply that to Ninja generated targets. Consider the property when calculating the flags.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx11
-rw-r--r--Source/cmTarget.cxx1
2 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1827a42..5ee1717 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1566,6 +1566,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
config);
+ if (lang == "Swift") {
+ if (const char* v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
+ if (cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER_EQUAL,
+ this->Makefile->GetDefinition("CMAKE_Swift_COMPILER_VERSION"),
+ "4.2")) {
+ this->AppendFlags(flags, "-swift-version " + std::string(v));
+ }
+ }
+ }
+
// Add MSVC runtime library flags. This is activated by the presence
// of a default selection whether or not it is overridden by a property.
const char* msvcRuntimeLibraryDefault =
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index bc1b9de..e3e175a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -347,6 +347,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
initProp("FOLDER");
+ initProp("Swift_LANGUAGE_VERSION");
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");
#ifdef __APPLE__