MAKE_FIND_ROOT_PATH_MODE_PACKAGE can be set to ONLY for cross compilation. However we need to find LLVMConfig from the host compiler, which is outside of the root path.
Set CMAKE_FIND_ROOT_PATH_BOTH when finding the LLVMConfig package.
kongyi on Mar 18 2023, 1:18 AM.Authored by
Do you have a doc link or some precedent? Something to help us understand the implications of this.
We cross compile compiler-rt for Android, and we set CMAKE_FIND_ROOT_PATH_MODE_* to ONLY to force using the correct sysroots.
I still don't understand the motivation behind this change. You already explicitly set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY for Android so why do we need to change the default?
We need to pull the build dependencies from the target root path, thus setting CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY. However LLVMConfig is different that we need the host version instead, as it records the configs of the host toolchain.