Cmake project loading

Nicolás Alvarez nicolas.alvarez at gmail.com
Thu Jun 10 03:32:51 UTC 2010


On 6/9/10, Benjamin Schindler <bschindler at inf.ethz.ch> wrote:
> Hi
>
> I just recently completely redesigned the (cmake-)build system for my
> project and it seems I've done something which kdevelop really does not
> like at all.
>
> The sample project I attached takes a very long time to load given that
> there are <100 source files listed. It seems to me that kdevelop gets
> hit by some infinite loop when autogenerating the source files from the
> xsd files (the files are generated using the codesynthesis xsd compiler)
>
> Could somebody have a look at this issue?

The problem seems to be caused by lack of proper variable scope in
functions, which I reported last month:

http://bugs.kde.org/show_bug.cgi?id=238455#c2

Many functions in your code are appending elements to variables, and
(correctly) expecting the variable to start empty at the beginning of
the function. In CMake, if you set a variable inside a function (and
don't use parent_scope), it goes away when the function ends. However,
in KDevelop, functions and macros work the same, and variables keep
their value when the function ends and it's later called again. In
other words, there is no such thing as a "local variable".

I think it'd take quite some work to add proper variable scopes.

As a workaround, clear those variables at the beginning of the
function. I searched for all SET calls that added stuff to a variable
with set(foo ${foo} somethingelse), were inside a function, and didn't
use PARENT_SCOPE, and I set them to "" at the beginning of the
function. The project now takes 3 seconds to load. Patch attached.

-- 
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: workaround-reset-local-variables.diff
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100610/a2e4296e/attachment.diff>


More information about the KDevelop-devel mailing list