diff options
author | Brad King <brad.king@kitware.com> | 2015-01-29 14:14:00 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-01-29 14:14:00 (GMT) |
commit | 326cfe2b30f0223ba676b966dc49a74972e4e4fb (patch) | |
tree | ef2953bd52b057efc6db8126118bc0a0a903646e /Source | |
parent | 98659aecfd819eb1e7771f7420933316a628b057 (diff) | |
parent | ab9fa54d4841e5b0eff8d241ad8edb47401b0394 (diff) | |
download | CMake-326cfe2b30f0223ba676b966dc49a74972e4e4fb.zip CMake-326cfe2b30f0223ba676b966dc49a74972e4e4fb.tar.gz CMake-326cfe2b30f0223ba676b966dc49a74972e4e4fb.tar.bz2 |
Merge topic 'xcode-revise-make-program'
ab9fa54d Xcode: Switch to internal CMAKE_MAKE_PROGRAM lookup by generator (#15324)
11e2e6ca Xcode: Select make program at build time
e4055a61 Xcode: Add internal API to find xcodebuild
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 47 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 7 |
3 files changed, 52 insertions, 21 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4c95a9f..6d0fedc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -315,25 +315,6 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) "make program", cmCacheManager::FILEPATH); } - - if(makeProgram.find("xcodebuild") != makeProgram.npos) - { - // due to the text file busy /bin/sh problem with xcodebuild - // use the cmakexbuild wrapper instead. This program - // will run xcodebuild and if it sees the error text file busy - // it will stop forwarding output, and let the build finish. - // Then it will retry the build. It will continue this - // until no text file busy errors occur. - std::string cmakexbuild = - this->CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_COMMAND"); - cmakexbuild = cmakexbuild.substr(0, cmakexbuild.length()-5); - cmakexbuild += "cmakexbuild"; - - mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", - cmakexbuild.c_str(), - "make program", - cmCacheManager::FILEPATH); - } } // enable the given language diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b6c428b..cd0dcc6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -136,13 +136,13 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]); this->XcodeVersion = 10*v[0] + v[1]; - this->FindMakeProgramFile = "CMakeFindXCode.cmake"; this->RootObject = 0; this->MainGroupChildren = 0; this->SourcesGroupChildren = 0; this->ResourcesGroupChildren = 0; this->CurrentMakefile = 0; this->CurrentLocalGenerator = 0; + this->XcodeBuildCommandInitialized = false; } //---------------------------------------------------------------------------- @@ -202,6 +202,49 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory } //---------------------------------------------------------------------------- +void cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf) +{ + // The Xcode generator knows how to lookup its build tool + // directly instead of needing a helper module to do it, so we + // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. + if(cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) + { + mf->AddDefinition("CMAKE_MAKE_PROGRAM", + this->GetXcodeBuildCommand().c_str()); + } +} + +//---------------------------------------------------------------------------- +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) { @@ -272,7 +315,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( { // now build the test makeCommand.push_back( - this->SelectMakeProgram(makeProgram, "xcodebuild") + this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand()) ); makeCommand.push_back("-project"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index a39c8c7..f513e28 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -70,6 +70,8 @@ public: const std::string& suffix, std::string& dir); + virtual void FindMakeProgram(cmMakefile*); + ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const; ///! expand CFGIntDir @@ -212,6 +214,11 @@ protected: std::vector<cmXCodeObject*> XCodeObjects; cmXCodeObject* RootObject; private: + std::string const& GetXcodeBuildCommand(); + std::string FindXcodeBuildCommand(); + std::string XcodeBuildCommand; + bool XcodeBuildCommandInitialized; + void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} |