Merge topic 'HandleMacFrameworkIncludeDirs_13465'

a3815e6 -fix line length
9110d0e Eclipse on OSX: improve handling of framework include dirs (#13367)
d97b385 Eclipse on OSX: fix handling of framework include dirs (#13464)
This commit is contained in:
David Cole 2012-08-20 15:41:14 -04:00 committed by CMake Topic Stage
commit e04245e2d5
2 changed files with 14 additions and 1 deletions

View File

@ -42,7 +42,10 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
# split the output into lines and then remove leading and trailing spaces from each of them:
string(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}")
foreach(nextLine ${_includeLines})
string(STRIP "${nextLine}" _includePath)
# on OSX, gcc says things like this: "/System/Library/Frameworks (framework directory)", strip the last part
string(REGEX REPLACE "\\(framework directory\\)" "" nextLineNoFramework "${nextLine}")
# strip spaces at the beginning and the end
string(STRIP "${nextLineNoFramework}" _includePath)
list(APPEND ${_resultIncludeDirs} "${_includePath}")
endforeach()

View File

@ -598,6 +598,16 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
if (!inc->empty())
{
std::string dir = cmSystemTools::CollapseFullPath(inc->c_str());
// handle framework include dirs on OSX, the remainder after the
// Frameworks/ part has to be stripped
// /System/Library/Frameworks/GLUT.framework/Headers
cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/");
if(frameworkRx.find(dir.c_str()))
{
dir = frameworkRx.match(1);
}
if(emittedDirs.find(dir) == emittedDirs.end())
{
emittedDirs.insert(dir);