Home > Uncategorized > Converting KDevelop3 project to KDevelop4

Converting KDevelop3 project to KDevelop4

    KDevelop4 has adopted CMake build system over AutoMake build system of KDevelop3. So, projects that are hosted on KDevelop3 environment cannot work seamlessly on KDevelop4 environment, which makes is practically impossible to migrate to KDevelop4 which is far superior in terms of functionality and usability.  Moreover, all latest Ubuntu flavors (Linux Mint 10 x64) give KDevelop4 as the default IDE under KDE.

    CMake is more powerful build system than Automake.  A very nice comparison of CMake and Autotools is found here.  The reason for KDevelop moving over to CMake is described in this article.  CMake also provides some scripts that help one to migrate the KDevelop3 projects to KDevelop4 CMake projects.  Once such script is am2cmake, which is written in Ruby.  If you run this script from the root directory of the KDevelop3 projects folder, the ruby script automatically reads Makefile.am and traverses through the directory to convert Makefile.am to CMakeLists.txt.  But there is a small bug in that.  While running the script on StaticLib directory, one might get the following error message:

converting Makefile.am
Makefile.am PROBLEM: target not found:  libanalyzer_server_a_SOURCES = Admin.cpp Admin.hpp AnalyzerC.cpp AnalyzerC.h     AnalyzerS.cpp AnalyzerS.h CmdInfo.cpp CmdInfo.hpp Config.cpp Config.hpp     Manager.cpp Manager.hpp ModelTask.cpp ModelTask.hpp

The original Makefile.am that was converted is:

INCLUDES = -I$(top_srcdir)/config -I$(top_srcdir)/idls -I$(top_srcdir)/libs \
    -I$(top_srcdir)/libs/bgtLicensing -I$(top_srcdir)/libs/hmm -I$(STL_ROOT)/stlport -I$(DEV_ROOT)/idls/src \
    -I$(TAO_ROOT)/orbsvcs/orbsvcs -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) -I$(ACE_ROOT)
lib_LIBRARIES = libanalyzer_server.a
libanalyzer_server_a_SOURCES = Admin.cpp Admin.hpp AnalyzerC.cpp AnalyzerC.h\
    AnalyzerS.cpp AnalyzerS.h CmdInfo.cpp CmdInfo.hpp Config.cpp Config.hpp\
    Manager.cpp Manager.hpp ModelTask.cpp ModelTask.hpp

Basically, while translating the Makefiles for static libs, am2cmake script does not know how to extract the target name from the Makefile.  By applying the below patch the problem was fixed.  Basically, a rule is added to addTarget function to handle lib_LIBRARIES = line from Makefile.am

>       elsif line =~ /^\s*lib_LIBRARIES\s*=\s*(\S+.*)/
>          targets=$1
>          type=StaticLib

[Updated 04/07/2011: A more or less completed script is available here for converting non KDE projects, which should transform all the projects from kdev3  (native c++ projects that are non-kde) to CMakeLists.txt format. Use ruby am2cmake.rb –no-kde to run the script.]

  1. Nicolas Zhong
    September 28th, 2013 at 07:37 | #1

    Very useful! THANKS!

  1. No trackbacks yet.
You must be logged in to post a comment.