1# build the auto gen config headers
2
3set(header_content "// AUTOGENERATED FROM PICO_CONFIG_HEADER_FILES and then PICO_<PLATFORM>_CONFIG_HEADER_FILES\n// DO NOT EDIT!\n")
4string(TOUPPER ${PICO_PLATFORM} PICO_PLATFORM_UPPER)
5string(REGEX REPLACE "-" "_" PICO_PLATFORM_UPPER "${PICO_PLATFORM_UPPER}")
6
7macro(add_header_content_from_var VAR)
8    set(header_content "${header_content}\n\n// based on ${VAR}:\n")
9    foreach(var IN LISTS ${VAR})
10        set(header_content "${header_content}\n#include \"${var}\"")
11    endforeach()
12endmacro()
13
14# PICO_CMAKE_CONFIG: PICO_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for all platforms, type=list, group=pico_base
15add_header_content_from_var(PICO_CONFIG_HEADER_FILES)
16
17# PICO_CMAKE_CONFIG: PICO_RP2040_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for the rp2040 platform only, type=list, group=pico_base
18# PICO_CMAKE_CONFIG: PICO_RP2350_ARM_S_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for the rp2350-arm-s platform only, type=list, group=pico_base
19# PICO_CMAKE_CONFIG: PICO_RP2350_RISCV_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for the riscv platform only, type=list, group=pico_base
20# PICO_CMAKE_CONFIG: PICO_HOST_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for the host platform only, type=list, group=pico_base
21add_header_content_from_var(PICO_${PICO_PLATFORM_UPPER}_CONFIG_HEADER_FILES)
22pico_register_common_scope_var(PICO_${PICO_PLATFORM_UPPER}_CONFIG_HEADER_FILES)
23
24file(GENERATE
25        OUTPUT  ${CMAKE_BINARY_DIR}/generated/pico_base/pico/config_autogen.h
26        CONTENT "${header_content}"
27        )
28
29configure_file( ${CMAKE_CURRENT_LIST_DIR}/include/pico/version.h.in ${CMAKE_BINARY_DIR}/generated/pico_base/pico/version.h)
30
31foreach(DIR IN LISTS PICO_INCLUDE_DIRS)
32    target_include_directories(pico_base_headers SYSTEM INTERFACE ${DIR})
33endforeach()
34