[CMake] CHECK_INCLUDE_FILES() and dependency headers

Jan Kneschke jan at kneschke.de
Thu Nov 19 06:02:50 EST 2009


Hi,

I have a few projects that have to check for net/if.h. At least on Mac  
OS X the fails with
CHECK_INCLUDE_FILES() even if the file exists as it needs some types  
that are imported through
sys/socket.h.

Looking at the template of Modules/CheckIncludeFile.c.in I see:

   #include <${CHECK_INCLUDE_FILE_VAR}>

and no way to add other includes before that.

Right now I use a multi-line hack to get sys/socket.h in, but I think  
there should be a easier
way to handle this:

   ## multi-line hack to get sys/socket.h included before net/if.h on  
MacOS X
   CHECK_INCLUDE_FILES("sys/socket.h>
   #include <net/if.h"  HAVE_NET_IF_H)

get expanded correctly and passes, but doesn't look "right".

Jan


More information about the CMake mailing list