KDevelop template: Simple CMake based C++ project

Alexander Neundorf neundorf at kde.org
Thu Feb 19 20:57:28 UTC 2009


On Thursday 19 February 2009, Alexander Neundorf wrote:
> On Thursday 19 February 2009, Andreas Pakulat wrote:
> > On 19.02.09 07:53:07, Gabor Garami wrote:
> > > Thanks a comment
> > >
> > >   - I added CMake module path adding because this project template
> > > doesn't assume any helper module (like KDE4 stuffs) installed, and, if
> > > I guess well, this needed if project provided by standalone.
> >
> > No its not needed. A CMakeLists.txt to compile main.cpp into foo looks
> > like this:
> >
> > project(foo)
> > add_executable(foo main.cpp)
>
> Now with cmake 2.6.x I would recommend adding a
> cmake_minimum_required(VERSION x.y[.z] FATAL_ERROR )
> at the top.
> Otherwise you will get warnings once your cmake file gets a bit bigger.

Ok, now I actually had a look at your files, this helps sometimes ;-)

One thing I'd like to add is, please use all-lower-case for the cmake 
commands, as is recommended: 
http://techbase.kde.org/Policies/CMake_Coding_Style

And please add some documentation for kapptemplate_add_app_templates(), it's 
hard to understand what the code actually does.

You may also consider the following using a variable for the source files:
set(%{APPNAMELC}Srcs main.cpp)
add_executable(%{APPNAMELC} ${%{APPNAMELC}Srcs})

Alex




More information about the KDevelop-devel mailing list