Skip to content

Commit a37351d

Browse files
committed
riscv: gcc: use string(APPEND
use string(APPEND instead of string(CONCAT where possible. Makes it shorter. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 7f76b27 commit a37351d

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

cmake/compiler/gcc/target_riscv.cmake

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ elseif(CONFIG_RISCV_CMODEL_LARGE)
1212
endif()
1313

1414
if(CONFIG_64BIT)
15-
string(CONCAT riscv_mabi ${riscv_mabi} "64")
16-
string(CONCAT riscv_march ${riscv_march} "64")
15+
string(APPEND riscv_mabi "64")
16+
string(APPEND riscv_march "64")
1717
else()
1818
string(CONCAT riscv_mabi "i" ${riscv_mabi} "32")
19-
string(CONCAT riscv_march ${riscv_march} "32")
19+
string(APPEND riscv_march "32")
2020
endif()
2121

2222
if(CONFIG_RISCV_ISA_RV32E)
23-
string(CONCAT riscv_mabi ${riscv_mabi} "e")
24-
string(CONCAT riscv_march ${riscv_march} "e")
23+
string(APPEND riscv_mabi "e")
24+
string(APPEND riscv_march "e")
2525
else()
26-
string(CONCAT riscv_march ${riscv_march} "i")
26+
string(APPEND riscv_march "i")
2727
endif()
2828

2929
if(CONFIG_RISCV_ISA_EXT_M)
30-
string(CONCAT riscv_march ${riscv_march} "m")
30+
string(APPEND riscv_march "m")
3131
endif()
3232

3333
if(CONFIG_RISCV_ISA_EXT_A)
34-
string(CONCAT riscv_march ${riscv_march} "a")
34+
string(APPEND riscv_march "a")
3535
endif()
3636

3737
if(CONFIG_FLOAT_HARD)
@@ -52,84 +52,84 @@ if(CONFIG_FPU)
5252
endif()
5353

5454
if(CONFIG_RISCV_ISA_EXT_C)
55-
string(CONCAT riscv_march ${riscv_march} "c")
55+
string(APPEND riscv_march "c")
5656
endif()
5757

5858
if(CONFIG_RISCV_ISA_EXT_ZICNTR)
59-
string(CONCAT riscv_march ${riscv_march} "_zicntr")
59+
string(APPEND riscv_march "_zicntr")
6060
endif()
6161

6262
if(CONFIG_RISCV_ISA_EXT_ZICSR)
63-
string(CONCAT riscv_march ${riscv_march} "_zicsr")
63+
string(APPEND riscv_march "_zicsr")
6464
endif()
6565

6666
if(CONFIG_RISCV_ISA_EXT_ZIFENCEI)
67-
string(CONCAT riscv_march ${riscv_march} "_zifencei")
67+
string(APPEND riscv_march "_zifencei")
6868
endif()
6969

7070
# Check whether we already imply Zaamo/Zalrsc by selecting the A extension; if not - check them
7171
# individually and enable them as needed
7272
if(NOT CONFIG_RISCV_ISA_EXT_A)
7373
if(CONFIG_RISCV_ISA_EXT_ZAAMO)
74-
string(CONCAT riscv_march ${riscv_march} "_zaamo")
74+
string(APPEND riscv_march "_zaamo")
7575
endif()
7676

7777
if(CONFIG_RISCV_ISA_EXT_ZALRSC)
78-
string(CONCAT riscv_march ${riscv_march} "_zalrsc")
78+
string(APPEND riscv_march "_zalrsc")
7979
endif()
8080
endif()
8181

8282
# Zca is implied by C
8383
if(CONFIG_RISCV_ISA_EXT_ZCA AND
8484
NOT CONFIG_RISCV_ISA_EXT_C)
85-
string(CONCAT riscv_march ${riscv_march} "_zca")
85+
string(APPEND riscv_march "_zca")
8686
endif()
8787

8888
if(CONFIG_RISCV_ISA_EXT_ZCB)
89-
string(CONCAT riscv_march ${riscv_march} "_zcb")
89+
string(APPEND riscv_march "_zcb")
9090
endif()
9191

9292
# Zcd is implied by C+D
9393
if(CONFIG_RISCV_ISA_EXT_ZCD AND
9494
NOT (CONFIG_RISCV_ISA_EXT_C AND CONFIG_RISCV_ISA_EXT_D))
95-
string(CONCAT riscv_march ${riscv_march} "_zcd")
95+
string(APPEND riscv_march "_zcd")
9696
endif()
9797

9898
# Zcf is implied by C+F
9999
if(CONFIG_RISCV_ISA_EXT_ZCF AND
100100
NOT (CONFIG_RISCV_ISA_EXT_C AND CONFIG_RISCV_ISA_EXT_F))
101-
string(CONCAT riscv_march ${riscv_march} "_zcf")
101+
string(APPEND riscv_march "_zcf")
102102
endif()
103103

104104
if(CONFIG_RISCV_ISA_EXT_ZCMP)
105-
string(CONCAT riscv_march ${riscv_march} "_zcmp")
105+
string(APPEND riscv_march "_zcmp")
106106
endif()
107107

108108
if(CONFIG_RISCV_ISA_EXT_ZCMT)
109-
string(CONCAT riscv_march ${riscv_march} "_zcmt")
109+
string(APPEND riscv_march "_zcmt")
110110
endif()
111111

112112
if(CONFIG_RISCV_ISA_EXT_ZBA)
113-
string(CONCAT riscv_march ${riscv_march} "_zba")
113+
string(APPEND riscv_march "_zba")
114114
endif()
115115

116116
if(CONFIG_RISCV_ISA_EXT_ZBB)
117-
string(CONCAT riscv_march ${riscv_march} "_zbb")
117+
string(APPEND riscv_march "_zbb")
118118
endif()
119119

120120
if(CONFIG_RISCV_ISA_EXT_ZBC)
121-
string(CONCAT riscv_march ${riscv_march} "_zbc")
121+
string(APPEND riscv_march "_zbc")
122122
endif()
123123

124124
if(CONFIG_RISCV_ISA_EXT_ZBS)
125-
string(CONCAT riscv_march ${riscv_march} "_zbs")
125+
string(APPEND riscv_march "_zbs")
126126
endif()
127127

128128
# Check whether we already imply Zmmul by selecting the M extension; if not - enable it
129129
if(NOT CONFIG_RISCV_ISA_EXT_M AND
130130
CONFIG_RISCV_ISA_EXT_ZMMUL AND
131131
"${GCC_COMPILER_VERSION}" VERSION_GREATER_EQUAL 13.0.0)
132-
string(CONCAT riscv_march ${riscv_march} "_zmmul")
132+
string(APPEND riscv_march "_zmmul")
133133
endif()
134134

135135
list(APPEND RISCV_C_FLAGS

0 commit comments

Comments
 (0)