DEFAULT_SYSROOT variable not used by the cmake

I am trying to build a clang-13 cross-compiler for RISCV using riscv-gnu-toolchain. Following is the cmake command I am using:

cmake -G Ninja -DCMAKE_BUILD_TYPE="Debug" \
  -DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True \
  -DCMAKE_INSTALL_PREFIX="../../_install" \
  -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False \
  -DDEFAULT_SYSROOT="/mnt/efs/home/aahmad/riscv/_install/sysroot/" \
  -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" \
  -DLLVM_TARGETS_TO_BUILD="RISCV" \
  -DLLVM_ENABLE_PROJECTS="clang" \
  -DLLVM_ENABLE_NEW_PASS_MANAGER=OFF \
  ../llvm

But when I run this command I get the following warning:

CMake Warning:
  Manually-specified variables were not used by the project:

    DEFAULT_SYSROOT

Please guide me on how can I get rid of this warning.

DEFAULT_SYSROOT appears to be used when cross compiling llvm. For example clang/cmake/caches/CrossWinToARMLinux.cmake uses it to compile from Windows, to Arm Linux.

I think you’re building clang to run on RISCV, so the option could be relevant. However I think the riscv-gnu toolchain will set up the sysroot for you regardless. I would guess that you can remove DEFAULT_SYSROOT and be fine.

FWIW I propose that we deprecated and remove DEFAULT_SYSROOT: ⚙ D158218 [CMake] Deprecate DEFAULT_SYSROOT and GCC_INSTALL_PREFIX