From c4ef72dd399bda662b5127b3d3733a0c8c79f054 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 25 Feb 2014 13:27:54 +0100 Subject: [PATCH] CMake: work-around for CodeBlocks lack of framework support. CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework paths. The work-around is to check if the include path ends in ".framework", and if so, add the parent directory as framework path. Task-number: QTCREATORBUG-11445 Change-Id: I794dd72d755d5593e36ebf59543d0a5e9fda3cce Reviewed-by: Daniel Teske Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/cmakeproject.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index a4658cb99ce..4bce4fa8e2b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -349,7 +349,22 @@ bool CMakeProject::parseCMakeLists() // This explicitly adds -I. to the include paths part->includePaths += projectDirectory(); - part->includePaths += cbpparser.includeFiles(); + + foreach (const QString &includeFile, cbpparser.includeFiles()) { + // CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework + // paths. The work-around is to check if the include path ends in ".framework", and + // if so, add the parent directory as framework path. + if (includeFile.endsWith(QLatin1String(".framework"))) { + const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/')); + if (slashIdx != -1) { + part->frameworkPaths += includeFile.left(slashIdx); + continue; + } + } + + part->includePaths += includeFile; + } + part->projectDefines += cbpparser.defines(); CppTools::ProjectFileAdder adder(part->files);