[CMake] CHECK_INCLUDE_FILES
Bill Hoffman
bill.hoffman at kitware.com
Thu Jul 31 11:20:23 EDT 2008
George Neill wrote:
> 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.
>
Opps, My bad... You just need to pass it in...
CHECK_INCLUDE_FILES(netinet/tcp.h;netinet/tcp.h HAVE_NETINET_TCP_H)
--
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518-371-3971 (phone and fax)
More information about the CMake
mailing list