Skip to content

Commit 8e47d14

Browse files
authored
Merge pull request #2608 from martin-frbg/issue2604
Handle trailing whitespace and empty variables in KERNEL files
2 parents 7181665 + cd10b35 commit 8e47d14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmake/utils.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ macro(ParseMakefileVars MAKEFILE_IN)
4343
if (NOT "${line_match}" STREQUAL "")
4444
#message(STATUS "match on ${line_match}")
4545
set(var_name ${CMAKE_MATCH_1})
46-
set(var_value ${CMAKE_MATCH_2})
46+
# set(var_value ${CMAKE_MATCH_2})
47+
string(STRIP ${CMAKE_MATCH_2} var_value)
4748
# check for Makefile variables in the string, e.g. $(TSUFFIX)
4849
string(REGEX MATCHALL "\\$\\(([0-9_a-zA-Z]+)\\)" make_var_matches ${var_value})
4950
foreach (make_var ${make_var_matches})
@@ -63,7 +64,7 @@ macro(ParseMakefileVars MAKEFILE_IN)
6364
string(REGEX MATCH "ifeq \\(\\$\\(([_A-Z]+)\\),[ \t]*([0-9_A-Z]+)\\)" line_match "${makefile_line}")
6465
if (NOT "${line_match}" STREQUAL "")
6566
# message(STATUS "IFEQ: ${line_match} first: ${CMAKE_MATCH_1} second: ${CMAKE_MATCH_2}")
66-
if (${${CMAKE_MATCH_1}} STREQUAL ${CMAKE_MATCH_2})
67+
if (DEFINED ${${CMAKE_MATCH_1}} AND ${${CMAKE_MATCH_1}} STREQUAL ${CMAKE_MATCH_2})
6768
# message (STATUS "condition is true")
6869
set (IfElse 1)
6970
else ()

0 commit comments

Comments
 (0)