[CMake] CHECK_INCLUDE_FILES ignores CMAKE_FIND_ROOT_PATH, but should it?

Rolf Eike Beer eike at sf-mail.de
Fri Jan 21 01:29:20 EST 2011


> 2011/1/20 Alexander Neundorf <a.neundorf-work at gmx.net>:

>> check_include_files() is there to check whether header files in the
>> compilers
>> system include path exist, i.e. which are found without any -I switches.
>> So, from that POV, the behaviour is ok.
>
> Aha, so software using check_include_files() to look for *external*
> packages/libraries _are doing it wrong_?
>
> But I don't understand the use case for check_include_files(). When
> would you want to limit yourself to only system include paths?

E.g. to check if stdint.h, unistd.h or io.h exists when you are supporting
platforms like Windows and Linux.

>> Can I actually tell the compiler/gcc to ignore its standard include dirs
>> ?
>
> AFAIK, GCC supports this. From 'man gcc':
>
> --sysroot=dir
>            Use dir as the logical root directory for headers and
> libraries.  For example, if the
>            compiler would normally search for headers in /usr/include
> and libraries in /usr/lib, it
>            will instead search dir/usr/include and dir/usr/lib.
>
>> What header files are you testing ?
>> From libc or from some other library ?
>
> The cdrkit package uses check_include_files() on at least
> sys/capability.h, from libcap. And libcap is an external library. So I
> guess the right thing would be to patch cdrkit?

Uh, don't know. Maybe FIND_PATH or FIND_FILE?

Eike


More information about the CMake mailing list