Commit 8c3290b4 authored by Brad King's avatar Brad King
Browse files

BUG: Use new include dir suppresson for all gens

This fixes CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to be used for all
generators instead of just those that construct their own compiler
command lines directly.  See issue #8598.
parent 3498a8c6
......@@ -1187,25 +1187,9 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
return this->LanguageToIncludeFlags[lang].c_str();
}
// Load implicit include directories for this language.
std::set<cmStdString> impDirs;
std::string impDirVar = "CMAKE_";
impDirVar += lang;
impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str()))
{
std::vector<std::string> impDirVec;
cmSystemTools::ExpandListArgument(value, impDirVec);
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
impDirs.insert(*i);
}
}
cmOStringStream includeFlags;
std::vector<std::string> includes;
this->GetIncludeDirectories(includes);
this->GetIncludeDirectories(includes, lang);
std::vector<std::string>::iterator i;
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
......@@ -1250,11 +1234,6 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
#endif
for(i = includes.begin(); i != includes.end(); ++i)
{
// Skip implicit include directories.
if(impDirs.find(*i) != impDirs.end())
{
continue;
}
#ifdef __APPLE__
if(cmSystemTools::IsPathToFramework(i->c_str()))
{
......@@ -1315,7 +1294,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
}
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
const char* lang)
{
// Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path.
......@@ -1381,6 +1361,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
}
}
// 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()))
{
std::vector<std::string> impDirVec;
cmSystemTools::ExpandListArgument(value, impDirVec);
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
emitted.insert(*i);
}
}
// Get the project-specified include directories.
std::vector<std::string>& includes =
this->Makefile->GetIncludeDirectories();
......
......@@ -189,7 +189,8 @@ public:
{ return true; }
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs);
void GetIncludeDirectories(std::vector<std::string>& dirs,
const char* lang = "C");
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment