From d97b38529efb22579216c406c104c49ea89ba617 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 10 Aug 2012 21:28:40 +0200 Subject: Eclipse on OSX: fix handling of framework include dirs (#13464) On OSX, the output from gcc looks like this: /usr/include/c++/4.2.1 /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64 /usr/include/c++/4.2.1/backward /usr/lib/gcc/i686-apple-darwin10/4.2.1/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. The "(framework directory)" part needs to be removed so that Eclipse handles it properly Alex --- .../CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 54a6418..1fa0157 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -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() -- cgit v0.12 From 9110d0eab4ed3b024ad485eaaf15b1d7e4c38744 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 10 Aug 2012 21:45:03 +0200 Subject: Eclipse on OSX: improve handling of framework include dirs (#13367) It seems that if cmake finds something like the following: /System/Library/Frameworks/GLUT.framework/Headers Eclipse doesn't like that and wants to have /System/Library/Frameworks instead Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 5c7d400..99ca375 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -610,6 +610,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 frameworkRegex("(.+/Frameworks)/.+\\.framework/"); + if(frameworkRegex.find(dir.c_str())) + { + dir = frameworkRegex.match(1); + } + if(emittedDirs.find(dir) == emittedDirs.end()) { emittedDirs.insert(dir); -- cgit v0.12 From a3815e67cf9ff7f542e809d8974b695893a6a783 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Aug 2012 23:37:15 +0200 Subject: -fix line length Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 99ca375..bb650eb 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -614,10 +614,10 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( // handle framework include dirs on OSX, the remainder after the // Frameworks/ part has to be stripped // /System/Library/Frameworks/GLUT.framework/Headers - cmsys::RegularExpression frameworkRegex("(.+/Frameworks)/.+\\.framework/"); - if(frameworkRegex.find(dir.c_str())) + cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/"); + if(frameworkRx.find(dir.c_str())) { - dir = frameworkRegex.match(1); + dir = frameworkRx.match(1); } if(emittedDirs.find(dir) == emittedDirs.end()) -- cgit v0.12