diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-29 16:23:31 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-29 18:34:04 (GMT) |
commit | 7bf490e9bb6128082aa178f28691b3fc418322fe (patch) | |
tree | a8f701d2db9a3960cceb1596705906c19ba42df4 /Source/cmTargetIncludeDirectoriesCommand.cxx | |
parent | f6b16d4b0642d26111cddff714b464e22b715482 (diff) | |
download | CMake-7bf490e9bb6128082aa178f28691b3fc418322fe.zip CMake-7bf490e9bb6128082aa178f28691b3fc418322fe.tar.gz CMake-7bf490e9bb6128082aa178f28691b3fc418322fe.tar.bz2 |
Make subclasses responsible for joining content.
This way we can add handling of relative/absolute paths and of
-D in compile definitions.
Diffstat (limited to 'Source/cmTargetIncludeDirectoriesCommand.cxx')
-rw-r--r-- | Source/cmTargetIncludeDirectoriesCommand.cxx | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index 51a2b6b..eaacfa9 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -41,12 +41,44 @@ void cmTargetIncludeDirectoriesCommand } //---------------------------------------------------------------------------- +static bool isGeneratorExpression(const std::string &lib) +{ + const std::string::size_type openpos = lib.find("$<"); + return (openpos != std::string::npos) + && (lib.find(">", openpos) != std::string::npos); +} + +//---------------------------------------------------------------------------- +std::string cmTargetIncludeDirectoriesCommand +::Join(const std::vector<std::string> &content) +{ + std::string dirs; + std::string sep; + std::string prefix = this->Makefile->GetStartDirectory() + std::string("/"); + for(std::vector<std::string>::const_iterator it = content.begin(); + it != content.end(); ++it) + { + if (cmSystemTools::FileIsFullPath(it->c_str()) + || isGeneratorExpression(*it)) + { + dirs += sep + *it; + } + else + { + dirs += sep + prefix + *it; + } + sep = ";"; + } + return dirs; +} + +//---------------------------------------------------------------------------- void cmTargetIncludeDirectoriesCommand -::HandleDirectContent(cmTarget *tgt, const std::string &content, +::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, bool prepend) { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); - cmMakefileIncludeDirectoriesEntry entry(content, lfbt); + cmMakefileIncludeDirectoriesEntry entry(this->Join(content), lfbt); tgt->InsertInclude(entry, prepend); } |