cmake: fix the fdiagnostics-color handle issue

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2024-10-18 19:58:18 +08:00 committed by Xiang Xiao
parent 9614e1fed5
commit 65aa5415a7
3 changed files with 10 additions and 8 deletions

View File

@ -391,14 +391,14 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/arch/${CONFIG_ARCH}/src/cmake)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/arch/${CONFIG_ARCH}/src/cmake/Toolchain.cmake")
# include common toolchain setting
include(nuttx_toolchain)
# Define project #############################################################
# This triggers configuration
project(NuttX LANGUAGES C CXX ASM)
# include common toolchain setting
include(nuttx_toolchain)
if(WIN32)
enable_language(ASM_MASM)
endif()

View File

@ -53,11 +53,6 @@ endif()
set(NO_LTO "-fno-lto")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.9)
# force color for gcc > 4.9
add_compile_options(-fdiagnostics-color=always)
endif()
# Workaround to skip -Warray-bounds check due to bug of GCC-12: Wrong warning
# array subscript [0] is outside array bounds:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523

View File

@ -23,6 +23,13 @@
# search. If the manual of the newly supported toolchain is different, you can
# override these methods in the toolchain
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.9)
# force color for gcc > 4.9
add_compile_options(-fdiagnostics-color=always)
endif()
endif()
# Support CMake to define additional configuration options
if(EXTRA_FLAGS)