[PATCH] D41623: [cmake] [libcxxabi] Fix path problems when cross compiling.

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 29 15:44:30 PST 2017


hintonda added a comment.

In https://reviews.llvm.org/D41623#965271, @compnerd wrote:

> I think that it might be better to handle this as a single global change:
>
>   if(CMAKE_FIND_ROOT_PATH)
>     set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
>   endif()


When I cross compile on Darwin and target Linux, I set sysroot and only want look for headers and libs in the new sysroot, not the host system.  However, in this case, I want to look for the just built headers.  This change helps support this.

As for global settings, this is what I'm setting in my toolchain file:

  SET(CMAKE_FIND_ROOT_PATH "${sysroot}" CACHE STRING "" FORCE)
  # adjust the default behavior of the FIND_XXX() commands:
  # search headers and libraries in the target environment, search
  # programs in the host environment
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "" FORCE)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" FORCE)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" FORCE)


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D41623





More information about the cfe-commits mailing list