Qt5/Mac header finding in KDevelop5 (cmake projects)
René J.V. Bertin
rjvbertin at gmail.com
Sun Jun 19 18:41:36 UTC 2016
Here's something that's been bothering me for a while. My Qt headerfile locations on OS X, where Qt installs as (real O:-)) frameworks:
For personal convenience there are symlinks in /opt/local/include:
/opt/local/include/qt4/QtCore -> /opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Headers
/opt/local/include/qt5/QtCore -> /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers
KDevelop4 never had trouble finding Qt headerfiles, neither with KDE4 nor with KF5 projects. As far as I can tell KDevelop5 also manages with KDE4 projects, but for every KF5 project I load I need to add a custom header search path via the settings: /opt/local/include/qt5 .
I think this must be due to the fact that Qt/OS X installs as frameworks, which leads to peculiar header search paths. An otherwise identical Qt5 + KF5 build on Linux doesn't have this issue: Qt's headers are in fact installed in /opt/local/include/qt5 .
For reference, a typical build compiler invocation on OS X:
cd /Users/bertin/work/src/new/KDE/KF5/skeleton-0.1/build/src && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DKCOREADDONS_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MAC_USE_COCOA -DQT_NO_DEBUG -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -Dskeleton_decoration_EXPORTS -I/Users/bertin/work/src/new/KDE/KF5/skeleton-0.1/build/src -I/Users/bertin/work/src/new/KDE/KF5/skeleton-0.1/src -iframework /opt/local/libexec/qt5/Library/Frameworks -isystem /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers -isystem /opt/local/share/qt5/mkspecs/macx-clang -isystem /opt/local/libexec/qt5/Library/Frameworks/QtGui.framework/Headers -isystem /System/Library/Frameworks/OpenGL.framework/Headers -isystem /opt/local/include/KF5/KCoreAddons -isystem /opt/local/include/KF5 -isystem /opt/local/include/KDecoration2 -O3 -g -march=core2 -arch x86_64 -std=c++0x -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -O2 -g -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -o CMakeFiles/skeleton_decoration.dir/skeleton.cpp.o -c /Users/bertin/work/src/new/KDE/KF5/skeleton-0.1/src/skeleton.cpp
I can imagine that KDevelop's parser doesn't know the `-iframework` option, but AFAIK it should know how to handle things like `-isystem /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers` which contains e.g. QtCore (so #include <QtCore> should work) ...
More information about the KDevelop-devel