Add API to get the ordered includes for a target.

This commit is contained in:
Stephen Kelly 2011-12-04 16:32:13 +01:00 committed by David Cole
parent 8adaee2b0b
commit a4d5f7b9b2
2 changed files with 27 additions and 0 deletions

View File

@ -4675,6 +4675,30 @@ cmTarget::GetLinkInformation(const char* config)
return i->second;
}
//----------------------------------------------------------------------------
std::vector<std::string> cmTarget::GetIncludeDirectories()
{
std::vector<std::string> includes;
const char *prop = this->GetProperty("INCLUDE_DIRECTORIES");
if(prop)
{
cmSystemTools::ExpandListArgument(prop, includes);
}
std::set<std::string> uniqueIncludes;
std::vector<std::string> orderedAndUniqueIncludes;
for(std::vector<std::string>::const_iterator
li = includes.begin(); li != includes.end(); ++li)
{
if(uniqueIncludes.insert(*li).second)
{
orderedAndUniqueIncludes.push_back(*li);
}
}
return orderedAndUniqueIncludes;
}
//----------------------------------------------------------------------------
cmTargetLinkInformationMap
::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()

View File

@ -458,6 +458,9 @@ public:
directory. */
bool UsesDefaultOutputDir(const char* config, bool implib);
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories();
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.