Code: Select all
add_custom_command(OUTPUT gen.c
COMMAND cp -a ${COMPONENT_DIR}/gen_template.c gen.c
DEPENDS ${COMPONENT_DIR}/gen_template.c)
add_custom_target(gen DEPENDS gen.c)
add_dependencies(${COMPONENT_LIB} gen)
idf_component_register(SRCS abc123.c
gen.c
INCLUDE_DIRS include)
Code: Select all
add_custom_command command is not scriptable
Code: Select all
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
add_custom_command(OUTPUT gen.c
COMMAND cp -a ${COMPONENT_DIR}/gen_template.c gen.c
DEPENDS ${COMPONENT_DIR}/gen_template.c)
add_custom_target(gen DEPENDS gen.c)
add_dependencies(${COMPONENT_LIB} gen)
endif()
idf_component_register(SRCS abc123.c
gen.c
INCLUDE_DIRS include)
Code: Select all
CMake Warning (dev) at components/abc123/CMakeLists.txt:7 (add_dependencies):
uninitialized variable 'COMPONENT_LIB'
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at components/abc123/CMakeLists.txt:7 (add_dependencies):
add_dependencies called with incorrect number of arguments
This is where I'm stuck at now. I'm wondering if the "CMAKE_BUILD_EARLY_EXPANSION" stuff is all just a red herring. If it were actually required, I would expect to see it in the docs.