[CMake] Complaint about if..endif

Eric NOULARD eric.noulard at gmail.com
Sun Nov 23 12:17:54 EST 2008


Le Sun, 23 Nov 2008 17:43:53 +0100,
cyril_wobow <cyril at wobow.com> a écrit :

> Robert Dailey a écrit :
> > On Sun, Nov 23, 2008 at 4:20 AM, cyril_wobow <cyril at wobow.com 
> > <mailto:cyril at wobow.com>> wrote:
> >
> >     Like a ... python front end ?
> >
> >     Seriously, cmake is really, really, really verbose and terribly
> >     unreadable as a scripting language...
> >
> >
> > I would agree with you in that CMake isn't perfect and it does have
> > a lot of issues that I've seen in the few hours I've spent learning
> > it. It has some issues with portability and it also is pretty 
> > unreadable/verbose in some cases. However, considering alternatives
> > I would say it could be worse. Boost.Build (BJam) is absolutely one
> > of the most unreadable languages I've seen. I refuse to use it just 
> > because of that fact. I also have yet to find another build system 
> > that generates visual studio project files like CMake does. It
> > would be nice to see alternatives for comparison though.
> Sure, I guess we are all here because CMake is a very powerful suite, 
> with tons of functionalities and useful abstractions. But I challenge 
> anyone to seriously tell me that he/she enjoys writing CMake script.
> As soon as you don't have to only set a bunch of variables and call a
> few built-in macros any more, you get crazy. Do a bit of string
> processing, you get crazy. Write/call your own functions and macros,
> with argument passing and returning, you get crazy.
> To me, that is definitely THE weakest point of CMake, along with its 
> fairly arnarchic documentation.
> I would be very interested by others' testimonies.
> Kudos anyway to the CMake team!

I do use CMake for some time now (something 2 years+).
I think is the best build system I know today.

CMake language is simple but this is NOT a scripting language.
As far as I remember CMake developer word (on ML) CMake was
designed as a _DECLARATIVE_ language:
  add_executable
  add_library
  install
  ...

So doing loop, string manipulation or any other 
non-declarative algorithmic computation is at best _weird_
even if it has been greatly improved with 2.6.x
(see PARENT_SCOPE for set, FUNCTION, ENDIF() ...)

I tend to do as much as I can do using CMake script,
for example my small CPackRPM contribution to CMake 
http://www.vtk.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
is almost all done in CMake scripts which a minimalist part in C++.

I did it this way because modification is easier without recompiling
CMake :-)

Now when I have to do some may be complex algorithmic things 
I first try doing it in scripts which is now easier each time
I do it because I gain experience.

Not to say that CMake scripting is pleasant, I would rather
go for python if I had a choice, however I manage to do what
I want with CMake, but my current project are not that big.
http://www.ohloh.net/projects/6472
http://www.ohloh.net/projects/6471

I think I don't need complex algorithmic features for my build process.
It may be far different for testing.
I'm using CTest too, but there I tend to write python scripts
which are launched by CTest
ADD_TEST(MyComplexTest wonderPythonScript.py)

My question to your usage would be, in which case do you need
complex function in your build system?
-- 
Erk


More information about the CMake mailing list