From 2eb13159ece322e8d42ccd29315c2671429f5560 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 1 Oct 2021 15:59:38 +0200 Subject: [PATCH] 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 --- cmake/kconfig.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake index 71668d0fe8a..1aac82f0dea 100644 --- a/cmake/kconfig.cmake +++ b/cmake/kconfig.cmake @@ -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()