CMake error with armclang

Hi

I would like to use ARMCLANG to build Mbedtls-3.0.0 library. A strange error comes:
My command is

cmake ..  -DCMAKE_C_COMPILER=armclang -DCMAKE_SYSTEM_PROCESSOR=cortex-m33  -DCMAKE_SYSTEM_ARCH=armv8-m.main

However it still warns me that Atleast one of the variables CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang.

I traced the message in /usr/local/share/cmake-3.18/Modules/Compiler/ARMClang.cmake:104, and print the CMAKE_SYSTEM_PROCESSOR and CMAKE_SYSTEM_ARCH in this file. It comes the result:

-- The C compiler identification is ARMClang 6.16.1
============================================
CMAKE_SYSTEM_PROCESSOR is x86_64
CMAKE_SYSTEM_ARCHITECTURE is armv8-m.main
============================================
-- Check for working C compiler: /home/sjl/software/ARMCLANG/bin/armclang
============================================
CMAKE_SYSTEM_PROCESSOR is x86_64
CMAKE_SYSTEM_ARCHITECTURE is 
============================================
CMake Error at /usr/local/share/cmake-3.18/Modules/Compiler/ARMClang.cmake:104 (message):
  Atleast one of the variables CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH
  must be set for ARMClang

My question is why the CMAKE_SYSTEM_PROCESSOR and CMAKE_SYSTEM_ARCHITECTURE are not my expected value?

Best Regards
Jianliang Shen

As I searched the document, I find using toochain file can solve a part of the issue, my toolchain file is:

unset(CMAKE_SYSTEM_PROCESSOR)
# unset(CMAKE_SYSTEM_ARCH)
set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
set(CMAKE_SYSTEM_ARCH armv8-m.main)

set(CMAKE_C_FLAGS   "-march=${CMAKE_SYSTEM_ARCH} -mcpu=${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT})

set(CMAKE_C_LINK_FLAGS   "--cpu=${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_ASM_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}")

With the toolchain file, cmake configuration passed, but make process failed, the CMAKE_SYSTEM_PROCESSOR is still X86_64:

-- The C compiler identification is ARMClang 6.16.1
============================================
CMAKE_SYSTEM_PROCESSOR is x86_64
CMAKE_SYSTEM_ARCHITECTURE is armv8-m.main
============================================
-- Detecting C compiler ABI info
============================================
CMAKE_SYSTEM_PROCESSOR is x86_64
CMAKE_SYSTEM_ARCHITECTURE is armv8-m.main
============================================
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/sjl/software/ARMCLANG/bin/armclang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python3: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter 
-- Looking for pthread.h
============================================
CMAKE_SYSTEM_PROCESSOR is x86_64
CMAKE_SYSTEM_ARCHITECTURE is armv8-m.main
============================================
-- Looking for pthread.h - not found
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sjl/work/tf-m/1.4.0/mbedtls/build