ENH: some fixes for better backwards compatibility
This commit is contained in:
parent
63185c1388
commit
345fb993aa
|
@ -869,7 +869,8 @@ cmGlobalUnixMakefileGenerator3
|
||||||
if(emitted.insert(lib->first).second)
|
if(emitted.insert(lib->first).second)
|
||||||
{
|
{
|
||||||
// Add this dependency.
|
// Add this dependency.
|
||||||
this->AppendAnyGlobalDepend(depends, lib->first.c_str(), emitted);
|
this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
|
||||||
|
emitted, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -883,7 +884,7 @@ cmGlobalUnixMakefileGenerator3
|
||||||
if(emitted.insert(*util).second)
|
if(emitted.insert(*util).second)
|
||||||
{
|
{
|
||||||
// Add this dependency.
|
// Add this dependency.
|
||||||
this->AppendAnyGlobalDepend(depends, util->c_str(), emitted);
|
this->AppendAnyGlobalDepend(depends, util->c_str(), emitted, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,41 +894,55 @@ cmGlobalUnixMakefileGenerator3
|
||||||
void
|
void
|
||||||
cmGlobalUnixMakefileGenerator3
|
cmGlobalUnixMakefileGenerator3
|
||||||
::AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name,
|
::AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name,
|
||||||
std::set<cmStdString>& emitted)
|
std::set<cmStdString>& emitted, cmTarget &target)
|
||||||
{
|
{
|
||||||
cmTarget *result;
|
cmTarget *result;
|
||||||
|
cmLocalUnixMakefileGenerator3 *lg3;
|
||||||
|
|
||||||
|
// first check the same dir as the current target
|
||||||
|
lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
|
||||||
|
(target.GetMakefile()->GetLocalGenerator());
|
||||||
|
result = target.GetMakefile()->FindTarget(name);
|
||||||
|
|
||||||
// search each local generator until a match is found
|
// search each local generator until a match is found
|
||||||
unsigned int i;
|
if (!result)
|
||||||
for (i = 0; i < m_LocalGenerators.size(); ++i)
|
|
||||||
{
|
{
|
||||||
// search all targets
|
unsigned int i;
|
||||||
result = m_LocalGenerators[i]->GetMakefile()->FindTarget(name);
|
for (i = 0; i < m_LocalGenerators.size(); ++i)
|
||||||
// if a match was found then ...
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
cmLocalUnixMakefileGenerator3 *lg3 =
|
// search all targets
|
||||||
static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
|
result = m_LocalGenerators[i]->GetMakefile()->FindTarget(name);
|
||||||
std::string tgtName = lg3->GetRelativeTargetDirectory(*result);
|
if (result)
|
||||||
tgtName += "/all";
|
|
||||||
depends.push_back(tgtName);
|
|
||||||
if(result->GetType() == cmTarget::STATIC_LIBRARY)
|
|
||||||
{
|
{
|
||||||
const cmTarget::LinkLibraries& tlibs = result->GetLinkLibraries();
|
lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
|
||||||
for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
|
(m_LocalGenerators[i]);
|
||||||
lib != tlibs.end(); ++lib)
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if a match was found then ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
std::string tgtName = lg3->GetRelativeTargetDirectory(*result);
|
||||||
|
tgtName += "/all";
|
||||||
|
depends.push_back(tgtName);
|
||||||
|
if(result->GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
|
{
|
||||||
|
const cmTarget::LinkLibraries& tlibs = result->GetLinkLibraries();
|
||||||
|
for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
|
||||||
|
lib != tlibs.end(); ++lib)
|
||||||
|
{
|
||||||
|
// Don't emit the same library twice for this target.
|
||||||
|
if(emitted.insert(lib->first).second)
|
||||||
{
|
{
|
||||||
// Don't emit the same library twice for this target.
|
// Add this dependency.
|
||||||
if(emitted.insert(lib->first).second)
|
this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
|
||||||
{
|
emitted, *result);
|
||||||
// Add this dependency.
|
|
||||||
this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
|
|
||||||
emitted);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,9 @@ protected:
|
||||||
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
|
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
|
||||||
cmTarget& target);
|
cmTarget& target);
|
||||||
void AppendAnyGlobalDepend(std::vector<std::string>& depends,
|
void AppendAnyGlobalDepend(std::vector<std::string>& depends,
|
||||||
const char* name, std::set<cmStdString>& emitted);
|
const char* name,
|
||||||
|
std::set<cmStdString>& emitted,
|
||||||
|
cmTarget &target);
|
||||||
|
|
||||||
// does this generator need a requires step for any of its targets
|
// does this generator need a requires step for any of its targets
|
||||||
bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg, const char *);
|
bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg, const char *);
|
||||||
|
|
|
@ -701,7 +701,8 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
|
||||||
cmTarget target;
|
cmTarget target;
|
||||||
target.SetType(cmTarget::UTILITY, utilityName);
|
target.SetType(cmTarget::UTILITY, utilityName);
|
||||||
target.SetInAll(all);
|
target.SetInAll(all);
|
||||||
|
target.SetMakefile(this);
|
||||||
|
|
||||||
// Store the custom command in the target.
|
// Store the custom command in the target.
|
||||||
cmCustomCommand cc(output, depends, commandLines, 0);
|
cmCustomCommand cc(output, depends, commandLines, 0);
|
||||||
target.GetPostBuildCommands().push_back(cc);
|
target.GetPostBuildCommands().push_back(cc);
|
||||||
|
|
|
@ -63,7 +63,8 @@ public:
|
||||||
|
|
||||||
///! Set the cmMakefile that owns this target
|
///! Set the cmMakefile that owns this target
|
||||||
void SetMakefile(cmMakefile *mf) { m_Makefile = mf; };
|
void SetMakefile(cmMakefile *mf) { m_Makefile = mf; };
|
||||||
|
cmMakefile *GetMakefile() { return m_Makefile;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of the custom commands for this target
|
* Get the list of the custom commands for this target
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue