Add optional BEFORE param to INCLUDE_DIRECTORIES so that include dirs can be specified before the actual include dirs
This commit is contained in:
parent
2fcf59b96b
commit
ef74458b34
|
@ -43,15 +43,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// cmIncludeDirectoryCommand
|
// cmIncludeDirectoryCommand
|
||||||
bool cmIncludeDirectoryCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmIncludeDirectoryCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
if(args.size() < 1 )
|
if(args.size() < 1 )
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(std::vector<std::string>::const_iterator i = args.begin();
|
|
||||||
i != args.end(); ++i)
|
std::vector<std::string>::const_iterator i = args.begin();
|
||||||
|
|
||||||
|
bool before = false;
|
||||||
|
if ((*i) == "BEFORE")
|
||||||
{
|
{
|
||||||
m_Makefile->AddIncludeDirectory((*i).c_str());
|
before = true;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; i != args.end(); ++i)
|
||||||
|
{
|
||||||
|
m_Makefile->AddIncludeDirectory((*i).c_str(), before);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
virtual const char* GetFullDocumentation()
|
virtual const char* GetFullDocumentation()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
"INCLUDE_DIRECTORIES(dir1 dir2 ...)";
|
"INCLUDE_DIRECTORIES([BEFORE] dir1 dir2 ...)";
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
|
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
|
||||||
|
|
|
@ -564,7 +564,7 @@ void cmMakefile::AddSubdirDependency(const char* subdir,
|
||||||
m_SubdirDepends[subdir].insert(dependency);
|
m_SubdirDepends[subdir].insert(dependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::AddIncludeDirectory(const char* inc)
|
void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
|
||||||
{
|
{
|
||||||
// Don't add an include directory that is already present. Yes,
|
// Don't add an include directory that is already present. Yes,
|
||||||
// this linear search results in n^2 behavior, but n won't be
|
// this linear search results in n^2 behavior, but n won't be
|
||||||
|
@ -573,7 +573,15 @@ void cmMakefile::AddIncludeDirectory(const char* inc)
|
||||||
if(std::find(m_IncludeDirectories.begin(),
|
if(std::find(m_IncludeDirectories.begin(),
|
||||||
m_IncludeDirectories.end(), inc) == m_IncludeDirectories.end())
|
m_IncludeDirectories.end(), inc) == m_IncludeDirectories.end())
|
||||||
{
|
{
|
||||||
m_IncludeDirectories.push_back(inc);
|
if (before)
|
||||||
|
{
|
||||||
|
// WARNING: this *is* expensive (linear time) since it's a vector
|
||||||
|
m_IncludeDirectories.insert(m_IncludeDirectories.begin(), inc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_IncludeDirectories.push_back(inc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Add an include directory to the build.
|
* Add an include directory to the build.
|
||||||
*/
|
*/
|
||||||
void AddIncludeDirectory(const char*);
|
void AddIncludeDirectory(const char*, bool before = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a variable definition to the build. This variable
|
* Add a variable definition to the build. This variable
|
||||||
|
|
Loading…
Reference in New Issue