[CMake] Check_Type_Size question

Tanner Lovelace clubjuggler at gmail.com
Fri Mar 31 00:41:36 EST 2006


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.

Cheers,
Tanner
--
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.


More information about the CMake mailing list