[CMake] Check_Type_Size question
Alexander Neundorf
a.neundorf-work at gmx.net
Fri Mar 31 02:49:17 EST 2006
> --- Ursprüngliche Nachricht ---
> Von: "Tanner Lovelace" <clubjuggler at gmail.com>
> An: "Cmake Mailing List" <cmake at cmake.org>
> Betreff: [CMake] Check_Type_Size question
> Datum: Fri, 31 Mar 2006 00:41:36 -0500
>
> Greetings,
>
> With the function check_type_size, I'm trying to, if an initial test
> fails,
> try it again with a different header file, but for some reason the
second
> test is never getting run. What am I doing wrong with this code?
>
> set(CMAKE_EXTRA_INCLUDE_FILES sys/statfs.h)
> check_type_size("struct statfs" HAVE_STRUCT_STATFS)
> SET(CMAKE_EXTRA_INCLUDE_FILES) #reset CMAKE_EXTRA_INCLUDE_FILES
>
> if(NOT HAVE_HAVE_STRUCT_STATFS)
> set(CMAKE_EXTRA_INCLUDE_FILES sys/mount.h)
> check_type_size("struct statfs" HAVE_STRUCT_STATFS)
> SET(CMAKE_EXTRA_INCLUDE_FILES) #reset CMAKE_EXTRA_INCLUDE_FILES
> endif(NOT HAVE_HAVE_STRUCT_STATFS)
>
> The problem is that on OS X Tiger, the file <sys/statfs.h> doesn't
> exist, but "struct statfs" is in <sys/mount.h>. Now I could just
> surround "set(CMAKE_EXTRA_INCLUDE_FILES ...)" with
> an if(APPLE) and set the correct header file for the correct
> platform, but I'd rather do it as a fallback in case apple later
> changes its mine and decides to put it in sys/statfs.h.
>
> Note, btw, that HAVE_HAVE_STRUCT_STATFS is set to
> HAVE_HAVE_STRUCT_STATFS:INTERNAL=false
> in CMakeCache.txt after running cmake.
>
> Any help would be appreciated! Thanks in advance.
I think the second test isn't executed because a variable with this name
already exists.
So you should give the result variables of the two tests different names
and then use something like:
IF (HAVE_STRUCT_STATFS_1 OR HAVE_STRUCT_STATFS_2)
SET(HAVE_STRUCT_STATFS TRUE)
ENDIF (HAVE_STRUCT_STATFS_1 OR HAVE_STRUCT_STATFS_2)
Bye
Alex
--
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer
More information about the CMake
mailing list