cmake: Fix USER_CACHE_DIR path generation

When the optional env_suffix_${env_var} was not set, USER_CACHE_DIR was
slightly malformed and had double slashes,
e.g. /home/user/.cache//zephyr.

To fix it string(JOIN ...) is used, which only sets slashes when
necessary.

Signed-off-by: Manoel Brunnen <mb@lee-brunnen.de>
This commit is contained in:
Manoel Brunnen 2023-05-08 09:37:41 +02:00 committed by Carles Cufí
parent 926219156b
commit 3953de793f

View file

@ -59,7 +59,7 @@ function(find_appropriate_cache_directory dir)
if(DEFINED ENV{${env_var}})
set(env_dir $ENV{${env_var}})
set(test_user_dir ${env_dir}/${env_suffix_${env_var}})
string(JOIN "/" test_user_dir ${env_dir} ${env_suffix_${env_var}})
execute_process(COMMAND ${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/build/dir_is_writeable.py ${test_user_dir}