cmake/tricore: filter out nostdlib in linker phase to avoid build break

Regression by:

| commit b64fb09e6c
| Author: xuxin19 <xuxin19@xiaomi.com>
| Date:   Tue Jul 16 15:50:13 2024 +0800
|
|     cmake:bugfix fix CMake LTO build block
|
|     it was wrong in https://github.com/apache/nuttx/pull/12423/files#r1618852245
|     EXTRA_FLAGS is useful in LTO for pass option tu lto linker
|
|     Signed-off-by: xuxin19 <xuxin19@xiaomi.com>

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-09-03 12:32:09 +08:00 committed by Xiang Xiao
parent fc6bcd6600
commit 2465b67c84
1 changed files with 3 additions and 1 deletions

View File

@ -23,7 +23,9 @@ get_directory_property(TOOLCHAIN_DIR_FLAGS DIRECTORY ${CMAKE_SOURCE_DIR}
set(NUTTX_EXTRA_FLAGS "")
foreach(FLAG ${TOOLCHAIN_DIR_FLAGS})
if(NOT FLAG MATCHES "^\\$<.*>$")
list(APPEND NUTTX_EXTRA_FLAGS ${FLAG})
if(NOT FLAG MATCHES "-nostdlib")
list(APPEND NUTTX_EXTRA_FLAGS ${FLAG})
endif()
else()
string(REGEX MATCH "\\$<\\$<COMPILE_LANGUAGE:C>:(.*)>" matched ${FLAG})
if(matched)