Fail to compile ARM assembly files by CMake

Hi,
I have cross compile environment with arm embedded toolchain(gcc-arm-none-eabi-5_4-2016q3) on Ubuntu20.04. If I try to compile ARM assembly file by cli, it works fine:

> arm-none-eabi-gcc -x assembler-with-cpp -mcpu=cortex-m7 -mthumb -I include/ src/sys/startup_file.s --specs=nosys.specs -c -o startup_file.o

However if I try to do the same by CMake, it complains:

Assembler messages:
Error: selected processor does not support `dmb' in ARM mode
Error: selected processor does not support `dsb' in ARM mode
Error: attempt to use an ARM instruction on a Thumb-only processor -- `strd R0,R1,[R2]'
Error: attempt to use an ARM instruction on a Thumb-only processor -- `bx R14'

For especially ASM, I’ve set following parameters in CMakeLists.txt and toolchain.cmake file respectively:
[CMakeLists.txt]

enable_language(C ASM)

[toolchain.cmake]

set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
unset(CMAKE_ASM_FLAGS CACHE)
set(CMAKE_ASM_FLAGS "-x assembler-with-cpp -mcpu=cortex-m7 -mthumb \
                    --specs=nosys.specs -c" CACHE STRING "" FORCE)

Do you see anything missing or wrong?

You need to use this variable instead I believe:
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_INIT.html

Toolchain files shouldn’t set CMAKE_LANG_FLAGS variable you need to set the _INIT equivalent.