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.
This commit is contained in:
Brad King 2009-02-26 09:16:16 -05:00
parent 3498a8c668
commit 8c3290b4a3
2 changed files with 20 additions and 24 deletions

View File

@ -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();

View File

@ -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);