Page MenuHomePhabricator

[CMAKE] Wrap the check_include_files() macro to make it honor sysroot
AbandonedPublic

Authored by Fabien on Thu, May 21, 15:12.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

In the case a sysroot is specified (via CMAKE_SYSROOT or
CMAKE_OSX_SYSROOT for example), all the find_* functions will take
it into account during the search. Unfortunately this is not the case
for check_include_files() which is designed to test for headers
implicitely included by the compiler (it does not only search, but also
builds a minimal program which uses the header).

This diff adds a wrapper to the check_include_files() to make it able
to find the headers in the case a sysroot is specified. This will make
it possible to test for headers located in the Apple Framework when
building for OSX.

This cause no change in the software behavior, as the only header found
that was previously missed on OSX is sys/select.h, and its only use is
for the glibc compatibility layer which is unused on OSX.

Test Plan

Build for OSX (both native and cross build).
Check the sys/select.h header is now found.

Event Timeline

Fabien created this revision.Thu, May 21, 15:12
Herald added a reviewer: Restricted Project. · View Herald TranscriptThu, May 21, 15:12
Fabien requested review of this revision.Thu, May 21, 15:12
Fabien planned changes to this revision.Thu, May 21, 15:16
Fabien abandoned this revision.Thu, May 21, 15:34

Despite the doc not stating it and the mailing list telling the opposite, it seems that check_include_files DOES use the sysroot...