summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-28 18:31:18 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-28 18:41:55 (GMT)
commite4055a6144c63c83fe2f39440ecfb9a0bcbfae0d (patch)
treef120a9d8e777f64173e7c9935d6684465ae39215 /Source/cmGlobalXCodeGenerator.cxx
parentde4ccee75a89519f95fcbcca75abc46577bfefea (diff)
downloadCMake-e4055a6144c63c83fe2f39440ecfb9a0bcbfae0d.zip
CMake-e4055a6144c63c83fe2f39440ecfb9a0bcbfae0d.tar.gz
CMake-e4055a6144c63c83fe2f39440ecfb9a0bcbfae0d.tar.bz2
Xcode: Add internal API to find xcodebuild
Teach the Xcode generator to compute the location of this tool or the cmakexbuild wrapper. Add internal APIs to get the locations on demand. Use the "cmakexbuild" wrapper for Xcode < 4, and "xcodebuild" for modern Xcode.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b6c428b..3b4dd17 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -143,6 +143,7 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
this->ResourcesGroupChildren = 0;
this->CurrentMakefile = 0;
this->CurrentLocalGenerator = 0;
+ this->XcodeBuildCommandInitialized = false;
}
//----------------------------------------------------------------------------
@@ -202,6 +203,36 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
}
//----------------------------------------------------------------------------
+std::string const& cmGlobalXCodeGenerator::GetXcodeBuildCommand()
+{
+ if(!this->XcodeBuildCommandInitialized)
+ {
+ this->XcodeBuildCommandInitialized = true;
+ this->XcodeBuildCommand = this->FindXcodeBuildCommand();
+ }
+ return this->XcodeBuildCommand;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
+{
+ if (this->XcodeVersion >= 40)
+ {
+ std::string makeProgram = cmSystemTools::FindProgram("xcodebuild");
+ if (makeProgram.empty())
+ {
+ makeProgram = "xcodebuild";
+ }
+ return makeProgram;
+ }
+ else
+ {
+ // Use cmakexbuild wrapper to suppress environment dump from output.
+ return cmSystemTools::GetCMakeCommand() + "xbuild";
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{