Cmake error with compiler-rt: string sub-command REPLACE requires at least four arguments

I am getting the following cmake error:

CMake Error at cmake/Modules/CompilerRTUtils.cmake:434 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:118 (construct_compiler_rt_default_triple)

Line 434 is the following line:

  string(REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})

The cmake command is:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-S ${LLVM_PROJECT_ROOT}/compiler-rt \
-B ${BUILD_DIR} \
-DCOMPILER_RT_BUILD_ORC=Off \
-DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL_ROOT} \
-DLLVM_RUNTIME_TARGETS='x86_64-unknown-linux-gnu;i386-unknown-linux-gnu'
...

The same command goes through without any errors with release/14.x.

Why is ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} becoming empty? Is it because LLVM_TARGET_TRIPLE is an empty string? If so, how should the cmake command line be changed to make this work? Should I just set it with the output of clang -dumpmachine? What is the recommended way?

PS: It looks like LLVM_RUNTIME_TARGETS is ignored if building compiler-rt (unlike libcxx).