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",
19 ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM));
22 //----------------------------------------------------------------------------
23 void cmTargetIncludeDirectoriesCommand
24 ::HandleImportedTarget(const std::string &tgt)
27 e << "Cannot specify include directories for imported target \""
29 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
32 //----------------------------------------------------------------------------
33 void cmTargetIncludeDirectoriesCommand
34 ::HandleMissingTarget(const std::string &name)
37 e << "Cannot specify include directories for target \"" << name << "\" "
38 "which is not built by this project.";
39 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
42 //----------------------------------------------------------------------------
43 std::string cmTargetIncludeDirectoriesCommand
44 ::Join(const std::vector<std::string> &content)
48 std::string prefix = this->Makefile->GetStartDirectory() + std::string("/");
49 for(std::vector<std::string>::const_iterator it = content.begin();
50 it != content.end(); ++it)
52 if (cmSystemTools::FileIsFullPath(it->c_str())
53 || cmGeneratorExpression::Find(*it) != std::string::npos)
59 dirs += sep + prefix + *it;
66 //----------------------------------------------------------------------------
67 void cmTargetIncludeDirectoriesCommand
68 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
69 bool prepend, bool system)
71 cmListFileBacktrace lfbt;
72 this->Makefile->GetBacktrace(lfbt);
73 cmValueWithOrigin entry(this->Join(content), lfbt);
74 tgt->InsertInclude(entry, prepend);
77 tgt->AddSystemIncludeDirectories(content);
81 //----------------------------------------------------------------------------
82 void cmTargetIncludeDirectoriesCommand
83 ::HandleInterfaceContent(cmTarget *tgt,
84 const std::vector<std::string> &content,
85 bool prepend, bool system)
87 cmTargetPropCommandBase::HandleInterfaceContent(tgt, content,
94 for(std::vector<std::string>::const_iterator it = content.begin();
95 it != content.end(); ++it)
101 tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",