diff options
| author | Avi <avibrender@gmail.com> | 2023-05-16 11:37:05 -0400 |
|---|---|---|
| committer | Avi <avibrender@gmail.com> | 2023-05-16 11:50:52 -0400 |
| commit | 85cdb61328eda782b24a7ecfa9da7ba9bba5021c (patch) | |
| tree | 79197ad823dbb4e2ae88e1c5803d3744422364c4 | |
| parent | 8b6fb5ef23c999080262218dd73c684ded399fbe (diff) | |
Add fatal `message()` when a required component is not found.
Without this nice formatting of the error, `idf.py build` returns a cryptic error (`__component_get_property Function invoked with incorrect arguments`).
| -rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f623f44..aa6a54f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,11 @@ idf_component_register(SRCS "src/platforms/esp32/esp32_i2s_parallel_dma.cpp" "sr # `idf_component_register` is processed during the "Enumeration" stage which happens before the sdkconfig file is loaded
# in the "Processing" stage. So if dependencies are going to be loaded based on certain CONFIG_* variables we must
# use `target_link_libraries` instead. This is the method used by Arduino's CMakeLists.txt file.
+idf_build_get_property(components BUILD_COMPONENTS)
foreach(component_name IN LISTS build_dependencies)
+ if (NOT ${component_name} IN_LIST components)
+ message(FATAL_ERROR "Missing component: ${component_name}")
+ endif()
idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} PUBLIC ${lib_name})
endforeach()
|
