hintonda added a comment. In https://reviews.llvm.org/D41623#982262, @hintonda wrote:
> In https://reviews.llvm.org/D41623#982189, @phosek wrote: > > > Isn't `NO_DEFAULT_PATH` more appropriate here? That's what libc++ uses as > > well. > > > Unfortunately no. > > When cross compiling, it's important to look for headers in CMAKE_SYSROOT > and/or CMAKE_FIND_ROOT_PATH, or you'll end up finding for headers on the > host, not the target. To make sure this works as expected, cmake recommends > using `set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)` -- see > https://cmake.org/Wiki/CMake_Cross_Compiling for details. > > With `CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY` and `CMAKE_SYSROOT` set, all > `find_XXX()` commands will add the `CMAKE_SYSROOT` prefix to all the paths > used in the search. So, if you are trying to look in a local source > directory, you'll never find it, because `find_XXX()` will actually use > `${CMAKE_SYSROOT}/<my local path>`, which is always the wrong place. > > These `find_path()` invocations are looking in specific places which exist on > the host system, not the target system. Btw, I'm not saying don't use `NO_DEFAULT_PATH` where appropriate, just that `NO_CMAKE_FIND_ROOT_PATH` is also required in this case. Repository: rCXXA libc++abi https://reviews.llvm.org/D41623 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits