cmTarget: Find source files on request.
In a follow-up, the list of sources will become dependent on the config, so check for existence in cmTarget::GetSourceFiles instead of up-front with cmGlobalGenerator::CheckTargets().
This commit is contained in:
parent
84e5f5a004
commit
f81eb49e8b
|
@ -1148,12 +1148,6 @@ void cmGlobalGenerator::Generate()
|
|||
return;
|
||||
}
|
||||
|
||||
// Check that all targets are valid.
|
||||
if(!this->CheckTargets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->FinalizeTargetCompileInfo();
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
|
@ -1305,35 +1299,6 @@ bool cmGlobalGenerator::ComputeTargetDepends()
|
|||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmGlobalGenerator::CheckTargets()
|
||||
{
|
||||
// Make sure all targets can find their source files.
|
||||
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
|
||||
{
|
||||
cmTargets& targets =
|
||||
this->LocalGenerators[i]->GetMakefile()->GetTargets();
|
||||
for(cmTargets::iterator ti = targets.begin();
|
||||
ti != targets.end(); ++ti)
|
||||
{
|
||||
cmTarget& target = ti->second;
|
||||
if(target.GetType() == cmTarget::EXECUTABLE ||
|
||||
target.GetType() == cmTarget::STATIC_LIBRARY ||
|
||||
target.GetType() == cmTarget::SHARED_LIBRARY ||
|
||||
target.GetType() == cmTarget::MODULE_LIBRARY ||
|
||||
target.GetType() == cmTarget::OBJECT_LIBRARY ||
|
||||
target.GetType() == cmTarget::UTILITY)
|
||||
{
|
||||
if(!target.FindSourceFiles())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
|
||||
{
|
||||
|
|
|
@ -340,7 +340,6 @@ protected:
|
|||
|
||||
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
|
||||
|
||||
bool CheckTargets();
|
||||
typedef std::vector<std::pair<cmQtAutoGenerators,
|
||||
cmTarget const*> > AutogensType;
|
||||
void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
|
||||
|
|
|
@ -522,10 +522,11 @@ bool cmTarget::IsBundleOnApple() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmTarget::FindSourceFiles()
|
||||
void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
|
||||
{
|
||||
assert(this->GetType() != INTERFACE_LIBRARY);
|
||||
for(std::vector<cmSourceFile*>::const_iterator
|
||||
si = this->SourceFiles.begin();
|
||||
si = this->SourceFiles.begin();
|
||||
si != this->SourceFiles.end(); ++si)
|
||||
{
|
||||
std::string e;
|
||||
|
@ -537,16 +538,9 @@ bool cmTarget::FindSourceFiles()
|
|||
cm->IssueMessage(cmake::FATAL_ERROR, e,
|
||||
this->GetBacktrace());
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
|
||||
{
|
||||
assert(this->GetType() != INTERFACE_LIBRARY);
|
||||
files = this->SourceFiles;
|
||||
}
|
||||
|
||||
|
|
|
@ -330,11 +330,6 @@ public:
|
|||
void
|
||||
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
|
||||
|
||||
/**
|
||||
* Make sure the full path to all source files is known.
|
||||
*/
|
||||
bool FindSourceFiles();
|
||||
|
||||
///! Return the preferred linker language for this target
|
||||
const char* GetLinkerLanguage(const char* config = 0,
|
||||
cmTarget const* head = 0) const;
|
||||
|
|
Loading…
Reference in New Issue