Making non-standard OS checks in cmake?

Alexander Neundorf neundorf at kde.org
Fri Jan 1 19:21:50 CET 2010


On Friday 01 January 2010, Raphael Kubo da Costa wrote:
> On Friday 01 January 2010 15:51:01 Raphael Kubo da Costa wrote:
> > Hey there,
> >
> > As you can see on my.cdash.org, both kdeadmin and kdenetwork fail to
> > build cleanly on FreeBSD:
> >
> >  * kdeadmin/kuser's CMakeLists.txt's check for the need to link against -
> > lcrypt is broken on FreeBSD,  since the crypt() function is defined in
> > unistd.h, not crypt.h, even though -lcrypt still must be passed to the
> > compiler
> >  * kdenetwork/kppp has been broken since FreeBSD 8.0 - currently the
> > ports system just disable its build, and I'd like to do the same
> > upstream.
> >
> > In both cases (the former can actually be solved in a different way, but
> > I have felt the need for this in other cases as well), it would be useful
> > to know if the current OS is FreeBSD, just like APPLE, WIN32 or UNIX are
> > set. Is there an easy way to do that?
>
> I mean, besides checking CMAKE_SYSTEM_NAME (or is it OK to do it that way?)

I think for excluding kppp checking CMAKE_SYSTEM_NAME should be ok (I mean you 
could also check for the missing header, but maybe this is too specific).
For the first issue I would prefer if you test which header provides crypt() 
instead checking CMAKE_SYSTEM_NAME.

Alex


More information about the Kde-buildsystem mailing list