From a4d5f7b9b270d3fa85e8a0a1608c4205dff744d9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Dec 2011 16:32:13 +0100 Subject: Add API to get the ordered includes for a target. --- Source/cmTarget.cxx | 24 ++++++++++++++++++++++++ Source/cmTarget.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c79b30..5c902e1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4676,6 +4676,30 @@ cmTarget::GetLinkInformation(const char* config) } //---------------------------------------------------------------------------- +std::vector cmTarget::GetIncludeDirectories() +{ + std::vector includes; + const char *prop = this->GetProperty("INCLUDE_DIRECTORIES"); + if(prop) + { + cmSystemTools::ExpandListArgument(prop, includes); + } + + std::set uniqueIncludes; + std::vector orderedAndUniqueIncludes; + for(std::vector::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() { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 59f0184..dfed499 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -458,6 +458,9 @@ public: directory. */ bool UsesDefaultOutputDir(const char* config, bool implib); + /** Get the include directories for this target. */ + std::vector GetIncludeDirectories(); + private: /** * A list of direct dependencies. Use in conjunction with DependencyMap. -- cgit v0.12