fix: Try to enclose args and paths in quotes

This commit is contained in:
Marek Fiala
2026-04-24 15:10:20 +02:00
committed by Fu Hanxi
parent 8a5cd0a285
commit bb2d197129

View File

@@ -97,9 +97,9 @@ endmacro()
#
function(__component_dir_quick_check var component_dir)
set(res 1)
get_filename_component(abs_dir ${component_dir} ABSOLUTE)
get_filename_component(abs_dir "${component_dir}" ABSOLUTE)
get_filename_component(base_dir ${abs_dir} NAME)
get_filename_component(base_dir "${abs_dir}" NAME)
string(SUBSTRING "${base_dir}" 0 1 first_char)
# Check the component directory contains a CMakeLists.txt file
@@ -149,8 +149,8 @@ function(__component_add component_dir prefix component_source)
# so later in the build, these component targets actually contain the properties meant for the
# corresponding component library.
idf_build_get_property(component_targets __COMPONENT_TARGETS)
get_filename_component(abs_dir ${component_dir} ABSOLUTE)
get_filename_component(base_dir ${abs_dir} NAME)
get_filename_component(abs_dir "${component_dir}" ABSOLUTE)
get_filename_component(base_dir "${abs_dir}" NAME)
if(NOT EXISTS "${abs_dir}/CMakeLists.txt")
message(FATAL_ERROR "Directory '${component_dir}' does not contain a component.")
@@ -277,15 +277,15 @@ macro(__component_add_sources sources)
message(WARNING "SRCS and SRC_DIRS are both specified; ignoring SRC_DIRS.")
endif()
foreach(src ${__SRCS})
get_filename_component(src "${src}" ABSOLUTE BASE_DIR ${COMPONENT_DIR})
list(APPEND sources ${src})
get_filename_component(src "${src}" ABSOLUTE BASE_DIR "${COMPONENT_DIR}")
list(APPEND sources "${src}")
endforeach()
else()
if(__SRC_DIRS)
foreach(dir ${__SRC_DIRS})
get_filename_component(abs_dir ${dir} ABSOLUTE BASE_DIR ${COMPONENT_DIR})
get_filename_component(abs_dir "${dir}" ABSOLUTE BASE_DIR "${COMPONENT_DIR}")
if(NOT IS_DIRECTORY ${abs_dir})
if(NOT IS_DIRECTORY "${abs_dir}")
message(FATAL_ERROR "SRC_DIRS entry '${dir}' does not exist.")
endif()
@@ -294,7 +294,7 @@ macro(__component_add_sources sources)
if(dir_sources)
foreach(src ${dir_sources})
get_filename_component(src "${src}" ABSOLUTE BASE_DIR ${COMPONENT_DIR})
get_filename_component(src "${src}" ABSOLUTE BASE_DIR "${COMPONENT_DIR}")
list(APPEND sources "${src}")
endforeach()
else()
@@ -316,11 +316,11 @@ endmacro()
macro(__component_add_include_dirs lib dirs type)
foreach(dir ${dirs})
get_filename_component(_dir ${dir} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT IS_DIRECTORY ${_dir})
get_filename_component(_dir "${dir}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
if(NOT IS_DIRECTORY "${_dir}")
message(FATAL_ERROR "Include directory '${_dir}' is not a directory.")
endif()
target_include_directories(${lib} ${type} ${_dir})
target_include_directories(${lib} ${type} "${_dir}")
endforeach()
endmacro()