2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2013-01-02 02:20:04 +04:00
|
|
|
#include "cmTargetIncludeDirectoriesCommand.h"
|
|
|
|
|
2014-02-17 14:08:58 +04:00
|
|
|
#include "cmGeneratorExpression.h"
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmTargetIncludeDirectoriesCommand::InitialPass(
|
|
|
|
std::vector<std::string> const& args, cmExecutionStatus&)
|
2013-01-02 02:20:04 +04:00
|
|
|
{
|
2013-01-20 17:04:13 +04:00
|
|
|
return this->HandleArguments(args, "INCLUDE_DIRECTORIES",
|
|
|
|
ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM));
|
2013-01-02 02:20:04 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmTargetIncludeDirectoriesCommand::HandleImportedTarget(
|
|
|
|
const std::string& tgt)
|
2013-01-02 02:20:04 +04:00
|
|
|
{
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream e;
|
2016-05-16 17:34:04 +03:00
|
|
|
e << "Cannot specify include directories for imported target \"" << tgt
|
|
|
|
<< "\".";
|
2013-01-02 02:20:04 +04:00
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmTargetIncludeDirectoriesCommand::HandleMissingTarget(
|
|
|
|
const std::string& name)
|
2013-01-02 02:20:04 +04:00
|
|
|
{
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream e;
|
2016-05-16 17:34:04 +03:00
|
|
|
e << "Cannot specify include directories for target \"" << name
|
|
|
|
<< "\" "
|
2013-01-02 02:20:04 +04:00
|
|
|
"which is not built by this project.";
|
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmTargetIncludeDirectoriesCommand::Join(
|
|
|
|
const std::vector<std::string>& content)
|
2013-01-29 20:23:31 +04:00
|
|
|
{
|
|
|
|
std::string dirs;
|
|
|
|
std::string sep;
|
2015-04-16 21:06:54 +03:00
|
|
|
std::string prefix =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->GetCurrentSourceDirectory() + std::string("/");
|
|
|
|
for (std::vector<std::string>::const_iterator it = content.begin();
|
|
|
|
it != content.end(); ++it) {
|
|
|
|
if (cmSystemTools::FileIsFullPath(it->c_str()) ||
|
|
|
|
cmGeneratorExpression::Find(*it) == 0) {
|
2013-01-29 20:23:31 +04:00
|
|
|
dirs += sep + *it;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2013-01-29 20:23:31 +04:00
|
|
|
dirs += sep + prefix + *it;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
sep = ";";
|
|
|
|
}
|
2013-01-29 20:23:31 +04:00
|
|
|
return dirs;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmTargetIncludeDirectoriesCommand::HandleDirectContent(
|
|
|
|
cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
|
|
|
|
bool system)
|
2013-01-02 02:20:04 +04:00
|
|
|
{
|
2014-05-23 22:41:46 +04:00
|
|
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
2015-07-09 00:35:01 +03:00
|
|
|
tgt->InsertInclude(this->Join(content), lfbt, prepend);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (system) {
|
2015-08-09 23:24:34 +03:00
|
|
|
std::string prefix =
|
|
|
|
this->Makefile->GetCurrentSourceDirectory() + std::string("/");
|
|
|
|
std::set<std::string> sdirs;
|
|
|
|
for (std::vector<std::string>::const_iterator it = content.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
it != content.end(); ++it) {
|
|
|
|
if (cmSystemTools::FileIsFullPath(it->c_str()) ||
|
|
|
|
cmGeneratorExpression::Find(*it) == 0) {
|
2015-08-09 23:24:34 +03:00
|
|
|
sdirs.insert(*it);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-08-09 23:24:34 +03:00
|
|
|
sdirs.insert(prefix + *it);
|
|
|
|
}
|
2013-01-20 17:04:13 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
tgt->AddSystemIncludeDirectories(sdirs);
|
|
|
|
}
|
2013-11-09 03:18:35 +04:00
|
|
|
return true;
|
2013-01-20 17:04:13 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmTargetIncludeDirectoriesCommand::HandleInterfaceContent(
|
|
|
|
cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
|
|
|
|
bool system)
|
2013-01-20 17:04:13 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
cmTargetPropCommandBase::HandleInterfaceContent(tgt, content, prepend,
|
|
|
|
system);
|
2013-07-02 16:30:10 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (system) {
|
2015-08-09 23:24:34 +03:00
|
|
|
std::string joined = this->Join(content);
|
2013-07-02 16:30:10 +04:00
|
|
|
tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
|
|
|
|
joined.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-01-02 02:20:04 +04:00
|
|
|
}
|