CMakeLists.txt 1.8 KB

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