BUG: Do not filter system directories for include file dependencies.

This commit is contained in:
Brad King 2006-09-28 09:49:40 -04:00
parent c717db3b88
commit 0b135767d6
3 changed files with 18 additions and 13 deletions

View File

@ -1096,7 +1096,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
}
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
bool filter_system_dirs)
{
// Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path.
@ -1170,18 +1171,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
}
}
// Do not explicitly add the standard include path "/usr/include".
// This can cause problems with certain standard library
// implementations because the wrong headers may be found first.
emitted.insert("/usr/include");
if(const char* implicitIncludes = this->Makefile->GetDefinition
("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))
if(filter_system_dirs)
{
std::vector<std::string> implicitIncludeVec;
cmSystemTools::ExpandListArgument(implicitIncludes, implicitIncludeVec);
for(unsigned int k = 0; k < implicitIncludeVec.size(); ++k)
// Do not explicitly add the standard include path "/usr/include".
// This can cause problems with certain standard library
// implementations because the wrong headers may be found first.
emitted.insert("/usr/include");
if(const char* implicitIncludes = this->Makefile->GetDefinition
("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))
{
emitted.insert(implicitIncludeVec[k]);
std::vector<std::string> implicitIncludeVec;
cmSystemTools::ExpandListArgument(implicitIncludes, implicitIncludeVec);
for(unsigned int k = 0; k < implicitIncludeVec.size(); ++k)
{
emitted.insert(implicitIncludeVec[k]);
}
}
}

View File

@ -170,7 +170,8 @@ public:
std::vector<cmStdString>* fullPathLibs=0);
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs);
void GetIncludeDirectories(std::vector<std::string>& dirs,
bool filter_system_dirs = true);
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);

View File

@ -467,7 +467,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
infoFileStream
<< "SET(CMAKE_C_INCLUDE_PATH\n";
std::vector<std::string> includeDirs;
this->GetIncludeDirectories(includeDirs);
this->GetIncludeDirectories(includeDirs, false);
for(std::vector<std::string>::iterator i = includeDirs.begin();
i != includeDirs.end(); ++i)
{