[CMake] CheckIncludeFiles: how to use?

Marcel Loose loose at astron.nl
Thu Jul 2 03:51:22 EDT 2009


Hi David,

That indeed seems to do the trick. The diagnostics are somewhat vague, though, 
if not to say incorrect.

-- Looking for include files var
-- Looking for include files var - found
-- var = 1

I think the line 
    MESSAGE(STATUS "Looking for include files ${VARIABLE}")
should read
    MESSAGE(STATUS "Looking for include files ${INCLUDE}")

Also, the variable var is not cached; there's no trace whatsoever in the 
CMakeCache.txt file of either stdio.h, unistd.h or var.

Seems to me that check_include_file() is preferred over check_include_files(). 
Any idea what's the use of the latter?

Best regards,
Marcel Loose.

On Wednesday 01 July 2009 15:48:15 David Cole wrote:
> Try:CHECK_INCLUDE_FILES("unistd.h;stdio.h" var)
>
> Or:
> SET(files unistd.h stdio.h)
> CHECK_INCLUDE_FILES("${files}" var)
>
> On Wed, Jul 1, 2009 at 4:13 AM, Marcel Loose <loose at astron.nl> wrote:
> > Hi all,
> >
> > Maybe it's because of a partially sleepless night, but I can't seem to
> > figure out how I should use check_include_files().
> >
> > According to the docs (and the implementation) this macro should be used
> > as:
> >
> >  CHECK_INCLUDE_FILES(INCLUDE VARIABLE)
> >
> > where INCLUDE should contain the list of files to include.
> > Problem is, however, that the following doesn't work:
> >
> >  CHECK_INCLUDE_FILES(unistd.h stdio.h var)
> >
> > because this will assign "unistd.h" to the variable INCLUDE and
> > "stdio.h" to the variable VARIABLE.
> >
> > The following also doesn't work:
> >
> >  SET(files unistd.h stdio.h)
> >  CHECK_INCLUDE_FILES(files var)
> >
> > because the variable INCLUDE is not handled as the name of the list
> > containing the header files, but as the name of the header file itself.
> >
> > Am I missing something here, or is this a bug in check_include_files()?
> >
> > Best regards,
> > Marcel Loose.
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list