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)
5
6macro(add_header_content_from_var VAR)
7    set(header_content "${header_content}\n\n// based on ${VAR}:\n")
8    foreach(var IN LISTS ${VAR})
9        set(header_content "${header_content}\n#include \"${var}\"")
10    endforeach()
11endmacro()
12
13# PICO_CMAKE_CONFIG: PICO_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for all platforms, type=list, default="", group=pico_base
14add_header_content_from_var(PICO_CONFIG_HEADER_FILES)
15
16# PICO_CMAKE_CONFIG: PICO_RP2040_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for rp2040 platform, type=list, default="", group=pico_base
17# PICO_CMAKE_CONFIG: PICO_HOST_CONFIG_HEADER_FILES, List of extra header files to include from pico/config.h for host platform, type=list, default="", group=pico_base
18add_header_content_from_var(PICO_${PICO_PLATFORM_UPPER}_CONFIG_HEADER_FILES)
19
20file(GENERATE
21        OUTPUT  ${CMAKE_BINARY_DIR}/generated/pico_base/pico/config_autogen.h
22        CONTENT "${header_content}"
23        )
24
25configure_file( ${CMAKE_CURRENT_LIST_DIR}/include/pico/version.h.in ${CMAKE_BINARY_DIR}/generated/pico_base/pico/version.h)
26
27foreach(DIR IN LISTS PICO_INCLUDE_DIRS)
28    target_include_directories(pico_base_headers INTERFACE ${DIR})
29endforeach()
30