[cmake-developers] KWSys patches

Domen Vrankar domen.vrankar at gmail.com
Mon Feb 16 14:47:41 EST 2015


> I'll get the KWSys patch through.  Once it is integrated into
> CMake then you can rebase the CMake part of the change on that.
>
> However, please revise the logic in the KWSys patch to avoid
> using exceptions.

I've noticed that exceptions are not used but was not certain how else
to handle this (and CMake at least printed out the error message
before exiting - did not know that this is common code for different
projects at the time).

I have a few ideas but they all seem semi optimal to me so I'll need
some guidance regarding this...

One option would be to return empty string from
Directory::GetCanonicalPath if an error occurs but currently when
Glob::FindFiles returns false error checking in CMake code treats it
as if no files were found so I don't think that returning false would
be the way to go.

Other option would be to call exit() inside the
Directory::GetCanonicalPath function but I guess that this would be
even worse than throwing an exception...

Third option that came to mid was to return empty string
Directory::GetCanonicalPath if an error occurs and simply ignore it in
Glob class - since the error should occur only rarely/never and
circular recursion is a corner case this is probably the best
solution...

One more question... When I first started writing the patch I thought
about printing out a warning if circular recursion is detected but was
not certain if it would be OK to just write the output to std::cerr
(or the kwsys wrapper equivalent) with canonical paths that caused it.
Should I leave out such message or would it be better to add it and
how?

Thanks,
Domen


More information about the cmake-developers mailing list