[CMake] CHECK_INCLUDE_FILES

George Neill georgen at neillnet.com
Thu Jul 31 15:49:27 EDT 2008


Bill,

On Thu, Jul 31, 2008 at 2:32 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> George Neill wrote:
>>
>> Bill,
>>
>>> I must be missing something (or there's a bug in CheckIncludeFiles.cmake)
>>>
>>> CHECK_INCLUDE_FILES(sys/types.h;netinet/tcp.h HAVE_NETINET_TCP_H)
>>> SET(HAVE_NETINET_TCP_H ${HAVE_NETINET_TCP_H} CACHE INTERNAL
>>> "netinet/tcp.h")
>>> .
>>> .
>>> .
>>> -- Looking for include files netinet/tcp.h
>>> -- Looking for include files netinet/tcp.h - found
>>> -- Looking for include files HAVE_SYS_SYSTEMINFO_H
>>> -- Looking for include files HAVE_SYS_SYSTEMINFO_H - found
>>>
>>> I have tried
>>>
>>> CHECK_INCLUDE_FILES(sys/types.h;netinet/tcp.h HAVE_NETINET_TCP_H)
>>>
>>> and
>>>
>>> LIST(APPEND NETINET sys/types.h netinet/tcp.h)
>>> CHECK_INCLUDE_FILES(${NETINET} HAVE_NETINET_TCP_H)
>>>
>>> and
>>>
>>> LIST(APPEND NETINET sys/types.h)
>>> LIST(APPEND NETINET netinet/tcp.h)
>>> CHECK_INCLUDE_FILES(${NETINET} HAVE_NETINET_TCP_H)
>>>
>>> all three of these provide the same results as above (I am using 2.4.8)
>>
>> I am tempted to write a macro with an interface like this,
>>
>> CHECK_INCLUDES( FILES sys/types.h netinet.h VARIABLE HAVE_NETINET_TCP_H)
>>
>> I suspect that might be better (for me anyhow) ... Thoughts?   it
>> looks like the list passed in to check_include_files is getting
>> exploded in to three arguments.
>>
>
> You have to use double quotes.
>
> From CMake/Utilities/cmcurl/CMakeLists.txt:
>
> MACRO(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
>  CHECK_INCLUDE_FILES("${CURL_INCLUDES};${FILE}" ${VARIABLE})
>  IF(${VARIABLE})
>    SET(CURL_INCLUDES ${CURL_INCLUDES} ${FILE})
>  ENDIF(${VARIABLE})
> ENDMACRO(CHECK_INCLUDE_FILE_CONCAT)
>
> So, this would work:
>
> CHECK_INCLUDE_FILES("sys/types.h;netinet/tcp.h" HAVE_NETINET_TCP_H)

Sorry, I took the long way around on that one.

Thanks much,
George.


More information about the CMake mailing list