Fix so that ADD_DEPENDENCIES work (the Utilities dependencies were not output)

This commit is contained in:
Sebastien Barre 2002-01-17 15:46:04 -05:00
parent e77515c2da
commit 201764e166
2 changed files with 63 additions and 5 deletions

View File

@ -830,6 +830,22 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
}
}
// Now, look at all utilities specific to this target.
const std::set<std::string>& tutils = l->second.GetUtilities();
for(std::set<std::string>::const_iterator util = tutils.begin();
util != tutils.end(); ++util)
{
// Record that this utility was used.
used.insert(*util);
// Don't emit the same utility twice for this target.
if(emitted.insert(*util).second)
{
// Output this dependency.
this->OutputExeDepend(fout, util->c_str());
}
}
fout << "\n";
}
}
@ -926,7 +942,6 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
{
// if the library is not in the current directory, then get the full
// path to it
libpath = cacheValue;
if(m_LibraryOutputPath.size())
{
libpath = m_LibraryOutputPath;
@ -934,6 +949,7 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
}
else
{
libpath = cacheValue;
libpath += "/";
libpath += m_LibraryPrefix;
}
@ -958,7 +974,7 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
{
libpath += m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
}
else
else if (libType && std::string(libType) == "STATIC")
{
libpath += m_StaticLibraryExtension;
}
@ -968,6 +984,47 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
}
void cmUnixMakefileGenerator::OutputExeDepend(std::ostream& fout,
const char* name)
{
const char* cacheValue = m_Makefile->GetDefinition(name);
if(cacheValue )
{
// if there is a cache value, then this is a executable/utility that cmake
// knows how to build, so we can depend on it
std::string exepath;
if (!this->SamePath(m_Makefile->GetCurrentOutputDirectory(), cacheValue))
{
// if the exe/utility is not in the current directory, then get the full
// path to it
if(m_ExecutableOutputPath.size())
{
exepath = m_ExecutableOutputPath;
}
else
{
exepath = cacheValue;
exepath += "/";
}
}
else
{
// library is in current Makefile
exepath = m_ExecutableOutputPath;
}
// add the library name
exepath += name;
// add the correct extension
if (m_Makefile->GetDefinition("CMAKE_EXECUTABLE_SUFFIX"))
{
exepath += m_Makefile->GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
}
fout << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(exepath.c_str()).c_str())
<< " ";
}
}
// fix up names of directories so they can be used
// as targets in makefiles.

View File

@ -127,6 +127,7 @@ protected:
virtual void OutputSubDirectoryRules(std::ostream&);
virtual void OutputDependLibs(std::ostream&);
virtual void OutputLibDepend(std::ostream&, const char*);
virtual void OutputExeDepend(std::ostream&, const char*);
virtual void OutputCustomRules(std::ostream&);
virtual void OutputMakeVariables(std::ostream&);
virtual void OutputMakeRules(std::ostream&);