mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
cmake: Warn if something which looks like a component directory isn't
Otherwise, fails build at the add_subdirectory stage
This commit is contained in:
parent
3cf56ea6b6
commit
99f8a811fd
@ -110,7 +110,7 @@ foreach(component_target ${build_component_targets})
|
||||
set(COMPONENT_NAME ${_name})
|
||||
set(COMPONENT_DIR ${dir})
|
||||
set(COMPONENT_ALIAS ${alias})
|
||||
set(COMPONENT_PATH ${dir}) # same deprecation situation here
|
||||
set(COMPONENT_PATH ${dir}) # also deprecated, see comment in previous loop
|
||||
idf_build_get_property(build_prefix __PREFIX)
|
||||
set(__idf_component_context 1)
|
||||
if(NOT prefix STREQUAL build_prefix)
|
||||
|
@ -112,6 +112,18 @@ function(__component_add component_dir prefix)
|
||||
get_filename_component(abs_dir ${component_dir} ABSOLUTE)
|
||||
get_filename_component(base_dir ${abs_dir} NAME)
|
||||
|
||||
# Check this is really a directory and that a CMakeLists.txt file for this component exists
|
||||
# - warn and skip anything which isn't valid looking (probably cruft)
|
||||
if(NOT IS_DIRECTORY "${abs_dir}")
|
||||
message(WARNING "Unexpected file in components directory: ${abs_dir}")
|
||||
return()
|
||||
endif()
|
||||
if(NOT EXISTS "${abs_dir}/CMakeLists.txt")
|
||||
message(WARNING "Component directory ${abs_dir} does not contain a CMakeLists.txt file. "
|
||||
"No component will be added")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(component_name ${base_dir})
|
||||
# The component target has three underscores as a prefix. The corresponding component library
|
||||
# only has two.
|
||||
|
Loading…
Reference in New Issue
Block a user