From a6b60841dbc56b896380435e4e190cbdc6e1a25a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 28 Apr 2004 13:21:56 -0400 Subject: BUG: fix for bug 116 platform files can now specify directories that should not be added by CMAKE --- Modules/Platform/Darwin.cmake | 2 ++ Source/cmLocalUnixMakefileGenerator.cxx | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 8c8dc3a..8a1fd17 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -25,3 +25,5 @@ SET(CMAKE_C_CREATE_SHARED_MODULE " -o ") INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) + +SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include) diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index 80dd767..9e221cc 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -2487,13 +2487,26 @@ void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout) std::vector::iterator i; fout << "-I" << this->ConvertToOutputForExisting(m_Makefile->GetStartDirectory()) << " "; + std::map implicitIncludes; + implicitIncludes["/usr/include"] = "/usr/include"; + if(m_Makefile->GetDefinition("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES")) + { + std::string arg = m_Makefile->GetDefinition("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"); + std::vector implicitIncludeVec; + cmSystemTools::ExpandListArgument(arg, implicitIncludeVec); + for(int k =0; k < implicitIncludeVec.size(); k++) + { + implicitIncludes[implicitIncludeVec[k]] = implicitIncludeVec[k]; + } + } + for(i = includes.begin(); i != includes.end(); ++i) { std::string include = *i; // Don't output a -I for the standard include path "/usr/include". // This can cause problems with certain standard library // implementations because the wrong headers may be found first. - if(include != "/usr/include") + if(implicitIncludes.find(include) == implicitIncludes.end()) { fout << "-I" << this->ConvertToOutputForExisting(i->c_str()) << " "; } -- cgit v0.12