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 // Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path. // 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". if(filter_system_dirs)
// 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"))
{ {
std::vector<std::string> implicitIncludeVec; // Do not explicitly add the standard include path "/usr/include".
cmSystemTools::ExpandListArgument(implicitIncludes, implicitIncludeVec); // This can cause problems with certain standard library
for(unsigned int k = 0; k < implicitIncludeVec.size(); ++k) // 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); std::vector<cmStdString>* fullPathLibs=0);
/** Get the include flags for the current makefile and language. */ /** 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. */ /** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source); const char* GetSourceFileLanguage(const cmSourceFile& source);

View File

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