Currently I am trying to create a brand new project using KDevelop 4.7.3. I am also targeting Qt5. When I attempt to create a new project using the template for a Qt Gui project it creates a Qt4 project and then I alter the cmake file to Qt5, but in either state Qt4, or Qt5 it doesn't find the library header files to do semantic analysis, or even compile.
Just curious how to fix this issue. I have Qt Creator installed(works fine) and KDevelop on Kubuntu so I am assuming I have the required libraries already, but let me know if I am missing something.
Below is the make file that it automatically creates with a few additions on my part. Please edit as necessary.
cmake_minimum_required(VERSION 2.8)
project(stickykey)
find_package(Qt5Core)
find_package(Qt5 REQUIRED Gui Widgets)
find_package(Qt5Widgets)
# # The Qt5Widgets_INCLUDES also includes the include directories for
# # dependencies QtCore and QtGui
include_directories(${Qt5Widgets_INCLUDES})
#
# # We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
add_definitions(${Qt5Widgets_DEFINITIONS})
#
# # Executables fail to build with Qt 5 in the default configuration
# # without -fPIE. We add that here.
# set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
set(StickyKey_SRCS StickyKey.cpp main.cpp)
#qt5_automoc(${StickyKey_SRCS})
add_executable(stickykey ${StickyKey_SRCS})
target_link_libraries(stickykey ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} Qt5::Widgets)
install(TARGETS stickykey RUNTIME DESTINATION bin)
UPDATE PPA
Supposedly this PPA will do the trick, but I haven't tried it as I am just using the git version so I can more easily build newer version in the future. If you want a nice packaged version then here is the launchpad. https://launchpad.net/~blaze/+archive/ubuntu/kf5/
CONTINUE BELOW FOR SOURCE COMPILE FROM KDE
I figured out how to solve the problem and it is pretty simple given the steps are written out and you can follow along. If you aren't comfortable compiling yourself though you might want to just wait for either a PPA, or backports at least if you are going to stick with 16.04.
In order to fix this issue you can either manually add all the correct paths while using the packaged version of Kdevelop, or you can build it from source.
I am using a version built from source and I can use it while still having the old version installed so if you follow the directions you should have two working version of KDevelop that do not conflict.
I will post the important bits here in case something happens to the link, but this should help.
Install dependencies
Add the following text to your ~/.gitconfig:
Install Kde Src Build
Configure kdesrc-build
Replace /path/to/kdesrc-build/kf5-qt5-build-include with ~/kdesrc/kdesrc-build/kf5-qt5-build-include in that file
Add ignore-kde-structure true and make-options -jN to the global section
install more dependencies
Copy these commands to a new file called ~/.env-kf5:
Run KDevelop
source