Build: Alter handling of --cpu flag for armlink
To be compliant with correct syntax, and better handle cases related to
the new armclang support in cmake 3.18.
Change-Id: I21535cf3658ab22cd5f7d2714bf1b12e25eed075
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/toolchain_ARMCLANG.cmake b/toolchain_ARMCLANG.cmake
index 9e8faf0..003fe99 100644
--- a/toolchain_ARMCLANG.cmake
+++ b/toolchain_ARMCLANG.cmake
@@ -121,10 +121,14 @@
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_INIT})
set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT})
- # But armlink doesn't support this +dsp syntax, so take the cpu flag and
- # throw away the plus and everything after.
- string(REGEX REPLACE "\\+nodsp" ".no_dsp" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}")
- string(REGEX REPLACE "\\+nodsp" ".no_dsp" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}")
+ set(CMAKE_C_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}")
+ set(CMAKE_ASM_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}")
+ # But armlink doesn't support this +dsp syntax
+ string(REGEX REPLACE "\\+nodsp" "" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}")
+ string(REGEX REPLACE "\\+nodsp" "" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}")
+ # And uses different syntax for +nofp
+ string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS}")
+ string(REGEX REPLACE "\\+nofp" ".no_fp" CMAKE_ASM_LINK_FLAGS "${CMAKE_ASM_LINK_FLAGS}")
# Workaround for issues with --depend-single-line with armasm and Ninja
if (CMAKE_GENERATOR STREQUAL "Ninja")