You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/02/24 02:16:05 UTC
(nuttx) 02/03: cmake:correct the dequote execution of generating config.h
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7c1de0a347786541a5d8414dbc2c1d3d0b7e10eb
Author: xuxin19 <xu...@xiaomi.com>
AuthorDate: Wed Feb 21 16:44:22 2024 +0800
cmake:correct the dequote execution of generating config.h
handling quotation marks consistent with `cfgdefine.c`
Signed-off-by: xuxin19 <xu...@xiaomi.com>
---
cmake/nuttx_mkconfig.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/nuttx_mkconfig.cmake b/cmake/nuttx_mkconfig.cmake
index 19aeee494b..54b2e1072f 100644
--- a/cmake/nuttx_mkconfig.cmake
+++ b/cmake/nuttx_mkconfig.cmake
@@ -87,7 +87,6 @@ foreach(NameAndValue ${ConfigContents})
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
string(REGEX MATCH "^CONFIG[^=]+" NAME ${NameAndValue})
string(REPLACE "${NAME}=" "" VALUE ${NameAndValue})
-
if(NAME AND NOT "${VALUE}" STREQUAL "")
if(${VALUE} STREQUAL "y")
file(APPEND ${CONFIG_H} "#define ${NAME} 1\n")
@@ -99,7 +98,8 @@ foreach(NameAndValue ${ConfigContents})
foreach(dequote ${DEQUOTELIST})
if("${NAME}" STREQUAL "${dequote}")
if(NOT "${VALUE}" STREQUAL "\"\"")
- string(REGEX REPLACE "\"" "" VALUE ${VALUE})
+ string(REGEX REPLACE "^\"(.*)\"$" "\\1" VALUE "${VALUE}")
+ string(REGEX REPLACE "\\\\\\\"" "\"" VALUE "${VALUE}")
else()
set(VALUE)
file(APPEND ${CONFIG_H} "#undef ${NAME}\n")