fix scons --target=cmake command failure (#10276)

* fix scons --target=cmake command failure

* fix scons --menuconfig
scons: Reading SConscript files ...
Cannot found RT-Thread root directory, please check RTT_ROOT
This commit is contained in:
冥焱破晓 2025-05-21 22:15:04 +08:00 committed by GitHub
parent cd3789f8ec
commit d64ce335fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# for module compiling
import os
Import('RTT_ROOT')
Import('env')
from building import *

View File

@ -149,11 +149,11 @@ def GenerateCFiles(env, project, project_name):
if 'LIBS' in group.keys():
for f in group['LIBS']:
LINKER_LIBS += ' ' + f.replace("\\", "/") + '.lib'
cm_file.write("SET(CMAKE_EXE_LINKER_FLAGS \""+ re.sub(LINKER_FLAGS + '(\s*)', LINKER_FLAGS + ' ${CMAKE_SOURCE_DIR}/', LFLAGS) + LINKER_LIBS + "\")\n\n")
cm_file.write("SET(CMAKE_EXE_LINKER_FLAGS \""+ re.sub(LINKER_FLAGS + r'(\s*)', LINKER_FLAGS + r' ${CMAKE_SOURCE_DIR}/', LFLAGS) + LINKER_LIBS + "\")\n\n")
# get the c/cpp standard version from compilation flags
# not support the version with alphabet in `-std` param yet
pattern = re.compile('-std=[\w+]+')
pattern = re.compile(r'-std=[\w+]+')
c_standard = 11
if '-std=' in CFLAGS:
c_standard = re.search(pattern, CFLAGS).group(0)