feat(cmakev2/test): add simple executable test

Add a simple test_executable that links to all discovered components.
This is intended to verify if the component sources can be compiled
using the command `cmake --build build/ --target test_executable`. The
ldgen is not yet integrated, so the test_executable is not actually
created or linked. However, this process can be used to check if the
components are compiled.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-08-21 11:23:59 +02:00
parent f43f646ceb
commit 35d5eaac79

View File

@@ -11,8 +11,11 @@ project(cmakev2
VERSION 1.2.3
LANGUAGES C CXX ASM)
add_custom_target(flash)
idf_project_init()
# Test component priority
function(test_component_priority)
# Set the idf component to be replaced with a testing component of higher
@@ -202,6 +205,12 @@ function(test_include_component)
endif()
endfunction()
function(test_executable)
add_executable(test_executable components/component1/component1.c)
idf_build_library(INTERFACE test_executable_lib)
target_link_libraries(test_executable PRIVATE test_executable_lib)
endfunction()
# Run tests
test_component_priority()
test_idf_version()
@@ -211,6 +220,7 @@ test_idf_build_library()
test_kconfig()
test_project_properties()
test_include_component()
test_executable()
__dump_all_properties()
__generate_project_info()