summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-03 15:04:08 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-05-03 15:04:17 (GMT)
commit1fe2dc5ef2a1f262b125a2ba6a85f624ce150dd2 (patch)
treea1b7bdc9761376b32692223fc2b8b43bb4b4db29
parentbf3c08d648c398026eef363bb43d3f8bfaf2a286 (diff)
parent7e75568b001e29a7428d7489c57cebd909359571 (diff)
downloadCMake-1fe2dc5ef2a1f262b125a2ba6a85f624ce150dd2.zip
CMake-1fe2dc5ef2a1f262b125a2ba6a85f624ce150dd2.tar.gz
CMake-1fe2dc5ef2a1f262b125a2ba6a85f624ce150dd2.tar.bz2
Merge topic 'ipo-xcode'
7e75568b Xcode: Support IPO (LTO) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !785
-rw-r--r--Modules/CheckIPOSupported.cmake2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx7
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Tests/RunCMake/CMP0069/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake2
5 files changed, 10 insertions, 6 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index 712a95e..6bbde13 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -217,7 +217,7 @@ function(check_ipo_supported)
return()
endif()
- if(CMAKE_GENERATOR MATCHES "^(Visual Studio |Xcode$)")
+ if(CMAKE_GENERATOR MATCHES "^Visual Studio ")
_ipo_not_supported("CMake doesn't support IPO for current generator")
return()
endif()
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d99e3bb..95c1236 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1683,8 +1683,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
return;
}
- // Check IPO related warning/error.
- gtgt->IsIPOEnabled(configName);
+ if (gtgt->IsIPOEnabled(configName)) {
+ const char* ltoValue =
+ this->CurrentMakefile->IsOn("_CMAKE_LTO_THIN") ? "YES_THIN" : "YES";
+ buildSettings->AddAttribute("LLVM_LTO", this->CreateString(ltoValue));
+ }
// Add define flags
this->CurrentLocalGenerator->AppendFlags(
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index ee06074..a5d169f 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -90,6 +90,8 @@ public:
bool HasKnownObjectFileLocation(std::string* reason) const CM_OVERRIDE;
+ bool IsIPOSupported() const CM_OVERRIDE { return true; }
+
bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;
diff --git a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
index 61ba458..f44f840 100644
--- a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
@@ -5,7 +5,6 @@ run_cmake(CMP0069-NEW-cmake)
run_cmake(CMP0069-NEW-compiler)
run_cmake(CMP0069-WARN)
-string(COMPARE EQUAL "${RunCMake_GENERATOR}" "Xcode" is_xcode)
-if(is_xcode OR RunCMake_GENERATOR MATCHES "^Visual Studio ")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake(CMP0069-NEW-generator)
endif()
diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
index 588a75d..e145569 100644
--- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
@@ -8,6 +8,6 @@ run_cmake(not-supported-by-compiler)
run_cmake(save-to-result)
run_cmake(cmp0069-is-old)
-if(RunCMake_GENERATOR MATCHES "^(Visual Studio |Xcode$)")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake(not-supported-by-generator)
endif()