Automoc: append implicit includes after user-specified dirs
The commitd2536579
(Automoc: fix regression #13667, broken build in phonon, 2012-11-19) changed Automoc to try to re-add the Qt header dir if it was stripped out as an implicit include from the moc command line. When invoking a compiler, those directories are stripped out because they are built-in, but for moc, there are no built-in directories. The follow-up commitacc22400
(Automoc: get include dirs without stripping implicit include dirs off, 2012-12-07) went further by not removing the implicit include dirs, if they were specified specifically by the user. This had the remaining problem that the implicit include dirs appeared in a different order of precedence for moc compared to the compiler. Resolve that by stripping out the include dirs, where specified for the moc command line to, and then appending them at the end. Note that the order of the appended implicit include directories is the order they are specified in the CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES, not the order specified by the user.
This commit is contained in:
parent
d7a2a9c319
commit
753b905ec8
|
@ -1407,20 +1407,22 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stripImplicitInclDirs)
|
std::vector<std::string> implicitDirs;
|
||||||
|
// Load implicit include directories for this language.
|
||||||
|
std::string impDirVar = "CMAKE_";
|
||||||
|
impDirVar += lang;
|
||||||
|
impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
|
||||||
|
if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str()))
|
||||||
{
|
{
|
||||||
// Load implicit include directories for this language.
|
std::vector<std::string> impDirVec;
|
||||||
std::string impDirVar = "CMAKE_";
|
cmSystemTools::ExpandListArgument(value, impDirVec);
|
||||||
impDirVar += lang;
|
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
|
||||||
impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
|
i != impDirVec.end(); ++i)
|
||||||
if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str()))
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> impDirVec;
|
emitted.insert(*i);
|
||||||
cmSystemTools::ExpandListArgument(value, impDirVec);
|
if (!stripImplicitInclDirs)
|
||||||
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
|
|
||||||
i != impDirVec.end(); ++i)
|
|
||||||
{
|
{
|
||||||
emitted.insert(*i);
|
implicitDirs.push_back(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1463,6 +1465,15 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
|
||||||
dirs.push_back(*i);
|
dirs.push_back(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(std::vector<std::string>::const_iterator i = implicitDirs.begin();
|
||||||
|
i != implicitDirs.end(); ++i)
|
||||||
|
{
|
||||||
|
if(std::find(includes.begin(), includes.end(), *i) != includes.end())
|
||||||
|
{
|
||||||
|
dirs.push_back(*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
|
void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
|
||||||
|
|
Loading…
Reference in New Issue