fix GCCVER cmake define.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
cuiziwei 2024-10-21 20:41:37 +08:00 committed by Mateusz Szafoni
parent 35c278b716
commit 8e95f6800b
3 changed files with 5 additions and 5 deletions

View file

@ -60,7 +60,7 @@ set(NO_LTO "-fno-lto")
if(CONFIG_ARCH_TOOLCHAIN_GNU)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX MATCH "\\+\\+.* ([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
string(REGEX MATCH "([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
"${GCC_VERSION_OUTPUT}")
set(GCCVER ${CMAKE_MATCH_1})

View file

@ -192,9 +192,9 @@ endif()
if(CONFIG_ARCH_TOOLCHAIN_GNU)
if(NOT GCCVER)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE GCC_VERSION_INFO)
string(REGEX MATCH "[0-9]+\\.[0-9]+" GCC_VERSION ${GCC_VERSION_INFO})
string(REGEX REPLACE "\\..*" "" GCCVER ${GCC_VERSION})
OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX MATCH "([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
"${GCC_VERSION_OUTPUT}")
set(GCCVER ${CMAKE_MATCH_1})
endif()
if(GCCVER GREATER_EQUAL 12)

View file

@ -261,7 +261,7 @@ if(CONFIG_RISCV_TOOLCHAIN STREQUAL GNU_RVG)
if(NOT GCCVER)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX MATCH "\\+\\+.* ([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
string(REGEX MATCH "([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
"${GCC_VERSION_OUTPUT}")
set(GCCVER ${CMAKE_MATCH_1})
endif()