1# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=string, default=pico, group=build
2if (DEFINED ENV{PICO_BOARD})
3    set(PICO_BOARD $ENV{PICO_BOARD})
4    message("Using PICO_BOARD from environment ('${PICO_BOARD}')")
5else()
6    if (NOT PICO_BOARD)
7        set(PICO_BOARD "pico")
8        pico_message("Defaulting PICO target board to ${PICO_BOARD} since not specified.")
9    else()
10        message("PICO target board is ${PICO_BOARD}.")
11    endif()
12endif()
13set(PICO_BOARD ${PICO_BOARD} CACHE STRING "PICO target board (e.g. pico)")
14
15# PICO_CMAKE_CONFIG: PICO_BOARD_CMAKE_DIRS, Directories to look for <PICO_BOARD>.cmake in. This is overridable from the user environment, type=list, default="", group=build
16if (DEFINED ENV{PICO_BOARD_CMAKE_DIRS})
17    set(PICO_BOARD_CMAKE_DIRS $ENV{PICO_BOARD_CMAKE_DIRS})
18    message("Using PICO_BOARD_CMAKE_DIRS from environment ('${PICO_BOARD_CMAKE_DIRS}')")
19endif()
20
21list(APPEND PICO_BOARD_CMAKE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards)
22
23pico_find_in_paths(PICO_BOARD_CMAKE_FILE PICO_BOARD_CMAKE_DIRS ${PICO_BOARD}.cmake)
24if (EXISTS "${PICO_BOARD_CMAKE_FILE}")
25    message("Using CMake board configuration from ${PICO_BOARD_CMAKE_FILE}")
26    include(${PICO_BOARD_CMAKE_FILE} board_config)
27else()
28    include(boards/generic_board.cmake)
29endif()
30
31list(APPEND PICO_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards/include) # so boards/foo.h can be explicitly included
32