blob: 0ab4c317d6cf7dc3bdc39c19048fa2010da5a24e [file] [log] [blame]
Austin Schuh208337d2022-01-01 14:29:11 -08001cmake_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
5if (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
12 if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
13 if (PICO_DEOPTIMIZED_DEBUG)
14 message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
15 else()
16 message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)")
17 endif()
18 endif()
19
20 pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT)
21
22 set(CMAKE_C_STANDARD 11)
23 set(CMAKE_CXX_STANDARD 11)
24
25 if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
26 set(PICO_SDK 1 PARENT_SCOPE)
27 endif()
28
29 # allow customization
30 add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
31 add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
32
33 add_subdirectory(tools)
34 add_subdirectory(src)
35
36 # allow customization
37 add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
38 add_sub_list_files(PICO_SDK_POST_LIST_FILES)
39
40 if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
41 set(PICO_SDK_TESTS_ENABLED 1)
42 endif()
43 if (PICO_SDK_TESTS_ENABLED)
44 add_subdirectory(test)
45 endif ()
46
47 set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
48
49 # add docs at the end, as we gather documentation dirs as we go
50 add_subdirectory(docs)
51
52 if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
53 pico_promote_common_scope_vars()
54 endif()
55endif()
56