Austin Schuh | 208337d | 2022-01-01 14:29:11 -0800 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.13) |
| 2 | |
| 3 | # Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK itself. For all other uses |
| 4 | # it is included as a subdirectory via the pico_sdk_init() method provided by pico_sdk_init.cmake |
| 5 | if (NOT TARGET _pico_sdk_inclusion_marker) |
| 6 | add_library(_pico_sdk_inclusion_marker INTERFACE) |
| 7 | # This is a no-op unless we are the top-level CMakeLists.txt |
| 8 | include(pico_sdk_init.cmake) |
| 9 | |
| 10 | project(pico_sdk C CXX ASM) |
| 11 | |
Ravago Jones | d208ae7 | 2023-02-13 02:24:07 -0800 | [diff] [blame] | 12 | message("Build type is ${CMAKE_BUILD_TYPE}") |
Austin Schuh | 208337d | 2022-01-01 14:29:11 -0800 | [diff] [blame] | 13 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
| 14 | if (PICO_DEOPTIMIZED_DEBUG) |
| 15 | message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)") |
| 16 | else() |
| 17 | message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)") |
| 18 | endif() |
| 19 | endif() |
| 20 | |
| 21 | pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT) |
| 22 | |
| 23 | set(CMAKE_C_STANDARD 11) |
| 24 | set(CMAKE_CXX_STANDARD 11) |
| 25 | |
| 26 | if (NOT PICO_SDK_TOP_LEVEL_PROJECT) |
| 27 | set(PICO_SDK 1 PARENT_SCOPE) |
| 28 | endif() |
| 29 | |
| 30 | # allow customization |
| 31 | add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS) |
| 32 | add_sub_list_files(PICO_SDK_PRE_LIST_FILES) |
| 33 | |
| 34 | add_subdirectory(tools) |
| 35 | add_subdirectory(src) |
| 36 | |
| 37 | # allow customization |
| 38 | add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS) |
| 39 | add_sub_list_files(PICO_SDK_POST_LIST_FILES) |
| 40 | |
| 41 | if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED) |
| 42 | set(PICO_SDK_TESTS_ENABLED 1) |
| 43 | endif() |
| 44 | if (PICO_SDK_TESTS_ENABLED) |
| 45 | add_subdirectory(test) |
| 46 | endif () |
| 47 | |
| 48 | set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests") |
| 49 | |
| 50 | # add docs at the end, as we gather documentation dirs as we go |
| 51 | add_subdirectory(docs) |
| 52 | |
| 53 | if (NOT PICO_SDK_TOP_LEVEL_PROJECT) |
| 54 | pico_promote_common_scope_vars() |
| 55 | endif() |
| 56 | endif() |
| 57 | |