• Brad King's avatar
    Prefix implicit include directories with sysroot on construction · 9502276f
    Brad King authored
    Since commit 7cd65c97 (Add CMAKE_SYSROOT variable to set --sysroot
    when cross compiling., 2013-04-13, v3.0.0-rc1~342^2) we have prefixed
    the value of `CMAKE_SYSROOT` to implicit include directories.  This was
    done because we hard-coded `/usr/include` as an implicit include
    directory without accounting for the sysroot.  Instead we should prefix
    the hard-coded paths when they are constructed.  Update the
    `Platform/UnixPaths` module to do this as `Platform/Darwin` already
    does.
    
    Since commit 5990ecb7 (Compute implicit include directories from
    compiler output, 2018-12-07, v3.14.0-rc1~108^2) the values of the
    `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variables are computed from
    a real compiler invocation so they already account for the sysroot
    prefix.  In commit 6fc33829 (Update logic for sysroot in detected
    implicit include directories, 2019-02-13, v3.14.0-rc2~6^2) we attempted
    to apply the prefix conditionally, but that is incorrect because the
    compiler's real implicit include directories are not all under the
    sysroot.  Instead assume that all implicit include directories in
    `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` already have the sysroot
    prefix if needed.  Code that constructs the value must be responsible
    for that because it is the only place that knows.
    9502276f
UnixPaths.cmake 2.73 KB