@@ -170,7 +170,6 @@ include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake")
170
170
if (DEFINED TARGET )
171
171
if (${TARGET} STREQUAL COOPERLAKE AND NOT NO_AVX512 )
172
172
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" )
173
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
174
173
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 10.09 )
175
174
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake" )
176
175
else ()
@@ -186,7 +185,6 @@ if (DEFINED TARGET)
186
185
endif ()
187
186
if (${TARGET} STREQUAL SAPPHIRERAPIDS AND NOT NO_AVX512 )
188
187
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" )
189
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
190
188
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 11.0 )
191
189
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=sapphirerapids" )
192
190
else ()
@@ -209,7 +207,6 @@ if (DEFINED TARGET)
209
207
210
208
if (((${TARGET} STREQUAL ZEN ) AND HAVE_AVX512VL ) AND NOT NO_AVX512 )
211
209
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" )
212
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
213
210
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 12.99 )
214
211
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=znver4" )
215
212
else ()
@@ -227,8 +224,7 @@ if (DEFINED TARGET)
227
224
228
225
if ((${TARGET} STREQUAL HASWELL OR (${TARGET} STREQUAL ZEN AND NOT HAVE_AVX512VL )) AND NOT NO_AVX2 )
229
226
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" )
230
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
231
- if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7 )
227
+ if (CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.7 )
232
228
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2" )
233
229
endif ()
234
230
elseif (${CMAKE_C_COMPILER_ID} STREQUAL "CLANG" )
@@ -267,20 +263,18 @@ if (DEFINED TARGET)
267
263
endif ()
268
264
269
265
if (${TARGET} STREQUAL POWER10 )
270
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
271
- if (${GCC_VERSION} VERSION_GREATER 10.2 OR ${GCC_VERSION} VERSION_EQUAL 10.2 )
266
+ if (CMAKE_C_COMPILER VERSION VERSION_GREATER 10.2 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.2 )
272
267
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math" )
273
268
else ()
274
- message (FATAL_ERROR "Compiler GCC. ${GCC_VERSION } does not support Power10." )
269
+ message (FATAL_ERROR "Compiler GCC ${CMAKE_C_COMPILER_VERSION } does not support Power10." )
275
270
endif ()
276
271
endif ()
277
272
if (${TARGET} STREQUAL POWER9 )
278
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
279
- if (${GCC_VERSION} VERSION_GREATER 5.0 OR ${GCC_VERSION} VERSION_EQUAL 5.0 )
273
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.0 )
280
274
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power9 -mtune=power9 -mvsx -fno-fast-math" )
281
275
else ()
282
276
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math" )
283
- message (WARNING "Compiler GCC. ${GCC_VERSION } does not support fully Power9." )
277
+ message (WARNING "Compiler GCC ${CMAKE_C_COMPILER_VERSION } does not support fully Power9." )
284
278
endif ()
285
279
endif ()
286
280
if (${TARGET} STREQUAL POWER8 )
@@ -291,23 +285,21 @@ if (${TARGET} STREQUAL NEOVERSEV1)
291
285
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE )
292
286
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve_intrinsics -march=armv8.4-a+sve -mtune=neoverse-v1" )
293
287
else ()
294
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
295
- if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4 )
288
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4 )
296
289
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.4-a+sve -mtune=neoverse-v1" )
297
290
else ()
298
- message (FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${GCC_VERSION } does not support Neoverse V1." )
291
+ message (FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION } does not support Neoverse V1." )
299
292
endif ()
300
293
endif ()
301
294
endif ()
302
295
if (${TARGET} STREQUAL NEOVERSEN2 )
303
296
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE )
304
297
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2" )
305
298
else ()
306
- execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
307
- if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4 )
299
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4 )
308
300
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2" )
309
301
else ()
310
- message (FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} {GCC_VERSION } does not support Neoverse N2." )
302
+ message (FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION } does not support Neoverse N2." )
311
303
endif ()
312
304
endif ()
313
305
endif ()
0 commit comments