1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2013 Stephen Kelly <steveire@gmail.com>
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmTargetIncludeDirectoriesCommand.h"
14 //----------------------------------------------------------------------------
15 bool cmTargetIncludeDirectoriesCommand
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
18 return this->HandleArguments(args, "INCLUDE_DIRECTORIES", PROCESS_BEFORE);
21 //----------------------------------------------------------------------------
22 void cmTargetIncludeDirectoriesCommand
23 ::HandleImportedTarget(const std::string &tgt)
26 e << "Cannot specify include directories for imported target \""
28 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
31 //----------------------------------------------------------------------------
32 void cmTargetIncludeDirectoriesCommand
33 ::HandleMissingTarget(const std::string &name)
36 e << "Cannot specify include directories for target \"" << name << "\" "
37 "which is not built by this project.";
38 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
41 //----------------------------------------------------------------------------
42 std::string cmTargetIncludeDirectoriesCommand
43 ::Join(const std::vector<std::string> &content)
47 std::string prefix = this->Makefile->GetStartDirectory() + std::string("/");
48 for(std::vector<std::string>::const_iterator it = content.begin();
49 it != content.end(); ++it)
51 if (cmSystemTools::FileIsFullPath(it->c_str())
52 || cmGeneratorExpression::Find(*it) != std::string::npos)
58 dirs += sep + prefix + *it;
65 //----------------------------------------------------------------------------
66 void cmTargetIncludeDirectoriesCommand
67 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
70 cmListFileBacktrace lfbt;
71 this->Makefile->GetBacktrace(lfbt);
72 cmValueWithOrigin entry(this->Join(content), lfbt);
73 tgt->InsertInclude(entry, prepend);