ENH: make sure depend helper actually works, if a depend library gets updated, then the target needs to be removed, and the CONFIGURATION directory needs to be used

This commit is contained in:
Bill Hoffman 2005-12-21 15:45:55 -05:00
parent 5b95c0a881
commit 391d3ed631
2 changed files with 42 additions and 7 deletions

View File

@ -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<std::string>::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<cmStdString> 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<cmStdString>::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,

View File

@ -142,6 +142,8 @@ private:
const std::vector<cmCustomCommand>&);
void CreateReRunCMakeFile(cmLocalGenerator* root);
protected:
std::string AddConfigDir(const char* d);
int m_XcodeVersion;
std::vector<cmXCodeObject*> m_XCodeObjects;
cmXCodeObject* m_RootObject;