diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 95b7c1dbe..8225a7293 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -386,6 +386,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root) cmSystemTools::MakeDirectory(m_CurrentReRunCMakeMakefile.c_str()); m_CurrentReRunCMakeMakefile += "/ReRunCMake.make"; cmGeneratedFileStream makefileStream(m_CurrentReRunCMakeMakefile.c_str()); + makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; makefileStream << "CMakeFiles/cmake.check_cache: "; for(std::vector::const_iterator i = lfiles.begin(); @@ -845,6 +846,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, { return; } + makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; makefileStream << "# Custom rules for " << target.GetName() << "\n"; @@ -1968,7 +1970,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( m_CurrentXCodeHackMakefile.c_str()); return; } - + makefileStream.SetCopyIfDifferent(true); // one more pass for external depend information not handled // correctly by xcode makefileStream << "# DO NOT EDIT\n"; @@ -1986,8 +1988,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( t->GetType() == cmTarget::MODULE_LIBRARY) { makefileStream << "\\\n\t" - << this-> - ConvertToRelativeForMake(this->GetTargetFullPath(target->GetcmTarget()).c_str()); + << this->AddConfigDir(this-> + ConvertToRelativeForMake(this->GetTargetFullPath(target->GetcmTarget()).c_str()).c_str()); } } makefileStream << "\n\n"; @@ -2005,7 +2007,9 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { if(emitted.insert(*d).second) { - makefileStream << this->ConvertToRelativeForMake(d->c_str()) << ":\n"; + makefileStream << + this->AddConfigDir(this->ConvertToRelativeForMake(d->c_str()).c_str()) + << ":\n"; } } } @@ -2026,20 +2030,49 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { std::vector const& deplibs = target->GetDependLibraries(); std::string tfull = this->GetTargetFullPath(target->GetcmTarget()); - makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) << ": "; + makefileStream << this->AddConfigDir( + this->ConvertToRelativeForMake(tfull.c_str()).c_str()) << ": "; for(std::vector::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { - makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(d->c_str()); + makefileStream << "\\\n\t" << + this->AddConfigDir( + this->ConvertToRelativeForMake(d->c_str()).c_str()); } makefileStream << "\n"; makefileStream << "\t/bin/rm -f " - << this->ConvertToRelativeForMake(tfull.c_str()) << "\n"; + << + this->AddConfigDir( + this->ConvertToRelativeForMake(tfull.c_str()).c_str()) + << "\n"; makefileStream << "\n\n"; } } } +//---------------------------------------------------------------------------- +std::string +cmGlobalXCodeGenerator::AddConfigDir(const char* d) +{ + if(m_XcodeVersion == 15) + { + return std::string(d); + } + std::string dir = d; + if(cmSystemTools::FileExists(d)) + { + return dir; + } + std::string::size_type pos = dir.rfind("/"); + if(pos == dir.npos) + { + return dir; + } + std::string ret = dir.substr(0, pos); + ret += "/${CONFIGURATION}"; + ret += dir.substr(pos); + return ret; +} //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 94f2ea267..4a519aa90 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -142,6 +142,8 @@ private: const std::vector&); void CreateReRunCMakeFile(cmLocalGenerator* root); protected: + std::string AddConfigDir(const char* d); + int m_XcodeVersion; std::vector m_XCodeObjects; cmXCodeObject* m_RootObject;