# components/perf_tests/CMakeLists.txt

cmake_minimum_required(VERSION 3.16)

# Build lists conditionally depending on Kconfig
set(PERF_SRCS "")
# Dependencies needed by external components that link to perf_tests (public)
set(PERF_PUBLIC_REQUIRES freertos esp_timer esp_system heap log)
# Dependencies needed only for compiling perf_tests's own sources (private)
# Always include unity since the source file includes it conditionally
set(PERF_PRIVATE_REQUIRES unity)

if(CONFIG_ENABLE_PERF_TESTS)
    list(APPEND PERF_SRCS "test/perf_tests.cpp")
endif()

# Single registration call
idf_component_register(
    SRCS ${PERF_SRCS}
    INCLUDE_DIRS "."
    REQUIRES ${PERF_PUBLIC_REQUIRES}    # Public dependencies
    PRIV_REQUIRES ${PERF_PRIVATE_REQUIRES} # Private dependencies
)