[CMake] CHECK_INCLUDE_FILES

George Neill georgen at neillnet.com
Thu Jul 31 11:04:13 EDT 2008


Bill,

>> I have ran into a problem on Solaris (v10/SS12) with
>> CHECK_INCLUDE_FILES.  I believe this is actually a bug in the header
>> file I am checking for but none-the-less it's a problem for me.  I am
>> using cmake 2.4.8.
>>
>> CHECK_INCLUDE_FILES(netinet/tcp.h HAVE_NETINET_TCP_H)
>>
>> here's a quick test program i wrote to mock up what
>> CHECK_INCLUDE_FILES() is doing ...
>>
>> -bash-3.00$ cat test.c
>> #include <netinet/tcp.h>
>>
>> int main()
>> {
>> return 0;
>> }
>>
>> Here's the compiler results,
>>
>> -bash-3.00$ cc test.c
>> "/usr/include/netinet/tcp.h", line 40: syntax error before or at: uint_t
>> cc: acomp failed for test.c
>>
>>
>> It's obvious to me the netinet/tcp.h header file should have included
>> sys/types.h
>>
>> My question is, is there a way to solve this without creating my own
>> check_include_files macro()?
>
>
> set(CMAKE_REQUIRED_INCLUDES "sys/types.h")
> CHECK_INCLUDE_FILES(netinet/tcp.h HAVE_NETINET_TCP_H)
>
> ./bin/cmake --help-module CheckIncludeFiles
>     The following variables may be set before calling this macro to modify
>       the way the check is run:
>
>         CMAKE_REQUIRED_FLAGS = string of compile command line flags
>         CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
>         CMAKE_REQUIRED_INCLUDES = list of include directories

Well crap, I saw CMAKE_REQUIRED_INCLUDES, but read it as a -I (include
directory) not a specific file to include.   I'll give that a try.

Thanks,
George.


More information about the CMake mailing list