Skip to content

Commit

Permalink
Add absolute path to CMakeLists.txt match statements (#469)
Browse files Browse the repository at this point in the history
* Add full path to match patterns in `CMakeLists.txt`

- This prevents absolute paths containing `$TARGET` before x-HEEP dir from being matched

* Restore original indentation
  • Loading branch information
StMiky authored Mar 8, 2024
1 parent 19ca765 commit b81f7f6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ FILE(GLOB_RECURSE new_list FOLLOW_SYMLINKS ${SOURCE_PATH}*.h)
SET(dir_list_str "")
FOREACH(file_path ${new_list})
SET(add 0) # This variable is set to 1 if the file_pth needs to be added to the list
if(${file_path} MATCHES "/device/")
if(${file_path} MATCHES "/target/") # Add it if its not in target, or if its in target/${TARGET}
if(${file_path} MATCHES ${TARGET})
if(${file_path} MATCHES "${ROOT_PROJECT}device/")
if(${file_path} MATCHES "${ROOT_PROJECT}device/target/") # Add it if its not in target, or if its in target/${TARGET}
if(${file_path} MATCHES "${ROOT_PROJECT}device/target/${TARGET}")
SET(add 1)
endif()
else()
SET(add 1)
endif()
elseif(${file_path} MATCHES ${PROJECT})
SET(add 1)
elseif( ( ${file_path} MATCHES "/freertos/" ) AND ( ${PROJECT} MATCHES "freertos" ) )
elseif( ( ${file_path} MATCHES "${ROOT_PROJECT}freertos/" ) AND ( ${PROJECT} MATCHES "freertos" ) )
SET(add 1)
elseif( ${file_path} MATCHES "/external/" )
elseif( ${file_path} MATCHES "${ROOT_PROJECT}external/" )
SET(add 1)
endif()

Expand Down Expand Up @@ -124,9 +124,9 @@ SET( c_dir_list "" )
SET( app_found 0 )
FOREACH(file_path IN LISTS new_list)
SET(add 0) # This variable is set to 1 if the file_pth needs to be added to the list
if(${file_path} MATCHES "/device/")
if(${file_path} MATCHES "${ROOT_PROJECT}device/")
SET(add 1)
elseif( ${file_path} MATCHES "/external/" )
elseif( ${file_path} MATCHES "${ROOT_PROJECT}external/" )
SET(add 1)
elseif( ( ${file_path} MATCHES "/${PROJECT}/" ) AND ( NOT ${file_path} MATCHES ${MAINFILE} ) )
SET(add 1)
Expand All @@ -153,7 +153,7 @@ if( app_found EQUAL 0 )
SET(c_dir_list "")
FOREACH(file_path IN LISTS new_list)
SET(add 0) # This variable is set to 1 if the file_pth needs to be added to the list
if(${file_path} MATCHES "/device/")
if(${file_path} MATCHES "${ROOT_PROJECT}device/")
SET(add 1)
elseif( ( ${file_path} MATCHES "/${PROJECT}/" ) AND ( NOT ${file_path} MATCHES ${MAINFILE} ) )
SET(add 1)
Expand Down

0 comments on commit b81f7f6

Please sign in to comment.