Andreas Pakulat apaku at gmx.de
Sun Jul 1 21:54:01 UTC 2007

On 01.07.07 19:30:34, Alexander Dymo wrote:
> On 7/1/07, Alexander Neundorf <neundorf at kde.org> wrote:
> > Hi Alex,
> >
> > On Friday 29 June 2007 15:21, Alexander Dymo wrote:
> > > > Yes, this is absolutely no problem with the generators. They can export
> > > > any information you want, since everything (regarding the build) is known
> > > > to them.
> > >
> > > Yes, export. That's not all we need. We need to "import" our changes
> > > back to CMake.
> >
> > Can you give me an example ?
> That's easy. Imagine there's a project with this CMakeLists.txt:
> include_directories (${CMAKE_SOURCE_DIR}/lib)
> set (foo_SRCS foo.cpp)
> kde4_add_plugin(fooplugin ${foo_SRCS})
> KDevelop needs to
> 1) understand what's there and present a project toolview with one
> "foo" target inside and allow the user to set include paths in the
> target's properties
> 2a) if the user adds another include dir in the properties (say
> we need to write this change back to the cmake file. To write it back
> we need to be able to understand where to write that change and how to
> write it (which commands to use, like include_directories for ex.).

I guess it should be added that we only need location information for
this to work. That is for a target we need to know the CMakeLists.txt
file where it is defined, the position of existing include_directories
calls can be used to just add the directory into that call instead of
composing a new one.

> 2b) if the user adds a target, KDevelop needs to know again where and
> how to write the change back to the CMake file

In this case KDevelop really just needs to know the proper
CMakeLists.txt, which could be done with a generator as well.

I'd like to add here, that my experience with the QMake Parser in
KDevelop3.4 shows that trying to do manipulation on the generated AST
and then writing that back to the file is not really a good idea. It
will mess up peoples files as you can't really guess the right format
(tab-indentation, no indentation, how much whitespace). So getting the
exact information of _where_ a certain command or argument of a command
"sits" is really important.

Think about changing the properties of a target, like setting NOGUI. One
needs to know where the target-name ends in the add_target call to
insert this argument.

Andreas, who will now start the 3rd iteration of the KDevelop4 QMake
Parser, without a writeBack method and including location information

You will feel hungry again in another hour.

More information about the KDevelop-devel mailing list