summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-25 16:44:46 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-25 16:44:46 (GMT)
commitcb788e8f6dfeeb5a934679f671adc87116837834 (patch)
treeed5632df00a4633e58b95538345cac730db49f1b /Source/cmLocalGenerator.cxx
parent261600bd090d1946c7c4fed80660b2ace216ddf8 (diff)
downloadCMake-cb788e8f6dfeeb5a934679f671adc87116837834.zip
CMake-cb788e8f6dfeeb5a934679f671adc87116837834.tar.gz
CMake-cb788e8f6dfeeb5a934679f671adc87116837834.tar.bz2
ENH: Re-enable system include dir suppression
This creates variable CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to specify implicit include directories on a per-language basis. This replaces the previous platform-wide variable. It is necessary to avoid explicit specification of -I/usr/include on some compilers (such as HP aCC) because: 1.) It may break ordering among system include directories defined internally by the compiler, thus getting wrong system headers. 2.) It tells the compiler to treat the system include directory as a user include directory, enabling warnings in the headers. See issue #8598.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b2788ae..70e5760 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1186,6 +1186,23 @@ 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);
@@ -1233,6 +1250,11 @@ 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()))
{