RE: [CMake] issue with CHECK FUNCTION EXISTS() and friends
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Jun 29 07:32:06 EDT 2005
> Von: "Thompson, David C" <dcthomp at sandia.gov>
> An: "Alexander Neundorf" <a.neundorf-work at gmx.net>, cmake at www.cmake.org
> Betreff: RE: [CMake] issue with CHECK FUNCTION EXISTS() and friends
> Datum: Wed, 29 Jun 2005 04:30:21 -0600
>
> > there is the family of CHECK_XXX_EXISTS() macros in the cmake
Modules.
> > They work quite well but I have a problem with them.
> > If the item which was searched for has been found HAVE_FOO is set to
> "1".
> > This is ok and works in all cases:
> > in config.h.cmake:
> > #define HAVE_FOO ${HAVE_FOO}
>
> Doesn't
>
> #cmakedefine HAVE_FOO
>
> in config.h.cmake do the right thing?
I didn't know this exists. Is it documented somewhere ?
So this produces either
#define HAVE_FOO
or
#undef HAVE_FOO
So it does the right thing for this usage. But it doesn't work for
defines which should be either 0 or 1, e.g. libltdl and nano X use them a
lot:
ltdl.c:
#if HAVE_STDLIB_H
...
#endif
This won't work with HAVE_STDLIB_H undefined.
I could do:
#cmakedefine HAVE_STDLIB_H_DUMMY
#ifdef HAVE_STDLIB_H_DUMMY
# define HAVE_STDLIB_H 1
#else
# define HAVE_STDLIB_H 0
#endif
which works but is ugly (at least for cmake standards).
Is there a better way ?
I could also add a new "keyword" like "#cmakeonoff" which would be
handled like "#cmakedefine" but switch between 0 and 1.
Or the idea with the patch for CheckFunctionExists.cmake ?
What do you think ?
Bye
Alex
--
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++
More information about the CMake
mailing list