Skip to content

Commit

Permalink
[cmake] [libunwind] Fix find_path() problems when cross compiling
Browse files Browse the repository at this point in the history
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxx project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

Differential Revision: https://reviews.llvm.org/D41621

llvm-svn: 323141
  • Loading branch information
donhinton committed Jan 22, 2018
1 parent 68aab34 commit 82c5878
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libunwind/CMakeLists.txt
Expand Up @@ -329,7 +329,8 @@ find_path(
PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
NO_DEFAULT_PATH
)
NO_CMAKE_FIND_ROOT_PATH
)
if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
Expand Down

0 comments on commit 82c5878

Please sign in to comment.