cmake: kconfig: use absolute files for merge_config_files

The `merge_config_files` list contains files with both relative and
absolute paths.
Each entry is checked and files with a relative path are converted to
absolute path. This creates a `merge_config_files_with_absolute_paths`
identical to the `merge_config_files` but with absolute path on each
entry.

Afterwards it is mixed whether `merge_config_files` or
`merge_config_files_with_absolute_paths` are used creating unnecessary
risk when the list with relative path files are used.

This commit sets the content of `merge_config_files` with updated
absolute paths files, and also updates all places to use this list.

This ensures that after path conversion then only the list with absolute
paths is used.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-10-01 15:59:38 +02:00 committed by Christopher Friedt
commit 2eb13159ec

View file

@ -204,8 +204,9 @@ foreach(f ${merge_config_files})
list(APPEND merge_config_files_with_absolute_paths ${path})
endforeach()
set(merge_config_files ${merge_config_files_with_absolute_paths})
foreach(f ${merge_config_files_with_absolute_paths})
foreach(f ${merge_config_files})
if(NOT EXISTS ${f} OR IS_DIRECTORY ${f})
message(FATAL_ERROR "File not found: ${f}")
endif()
@ -214,7 +215,7 @@ endforeach()
# Calculate a checksum of merge_config_files to determine if we need
# to re-generate .config
set(merge_config_files_checksum "")
foreach(f ${merge_config_files_with_absolute_paths})
foreach(f ${merge_config_files})
file(MD5 ${f} checksum)
set(merge_config_files_checksum "${merge_config_files_checksum}${checksum}")
endforeach()