Austin Schuh | 208337d | 2022-01-01 14:29:11 -0800 | [diff] [blame^] | 1 | # For boards without their own cmake file, simply include a header |
| 2 | |
| 3 | # PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, Directories to look for <PICO_BOARD>.h in. This is overridable from the user environment, type=list, default="", group=build |
| 4 | if (DEFINED ENV{PICO_BOARD_HEADER_DIRS}) |
| 5 | set(PICO_BOARD_HEADER_DIRS $ENV{PICO_BOARD_HEADER_DIRS}) |
| 6 | message("Using PICO_BOARD_HEADER_DIRS from environment ('${PICO_BOARD_HEADER_DIRS}')") |
| 7 | endif() |
| 8 | set(PICO_BOARD_HEADER_DIRS ${PICO_BOARD_HEADER_DIRS} CACHE STRING "PICO board header directories") |
| 9 | |
| 10 | list(APPEND PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/include/boards) |
| 11 | pico_find_in_paths(PICO_BOARD_HEADER_FILE PICO_BOARD_HEADER_DIRS ${PICO_BOARD}.h) |
| 12 | |
| 13 | if (EXISTS ${PICO_BOARD_HEADER_FILE}) |
| 14 | message("Using board configuration from ${PICO_BOARD_HEADER_FILE}") |
| 15 | list(APPEND PICO_CONFIG_HEADER_FILES ${PICO_BOARD_HEADER_FILE}) |
| 16 | else() |
| 17 | set(msg "Unable to find definition of board '${PICO_BOARD}' (specified by PICO_BOARD):\n") |
| 18 | list(JOIN PICO_BOARD_HEADER_DIRS ", " DIRS) |
| 19 | string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.h in ${DIRS} (additional paths specified by PICO_BOARD_HEADER_DIRS)\n") |
| 20 | list(JOIN PICO_BOARD_CMAKE_DIRS ", " DIRS) |
| 21 | string(CONCAT msg ${msg} " Looked for ${PICO_BOARD}.cmake in ${DIRS} (additional paths specified by PICO_BOARD_CMAKE_DIRS)") |
| 22 | message(FATAL_ERROR ${msg}) |
| 23 | endif() |