CMakeLists.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. message("Build type is ${CMAKE_BUILD_TYPE}")
  10. if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  11. if (PICO_DEOPTIMIZED_DEBUG)
  12. message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
  13. else()
  14. message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)")
  15. endif()
  16. endif()
  17. pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT)
  18. set(CMAKE_C_STANDARD 11)
  19. set(CMAKE_CXX_STANDARD 11)
  20. if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
  21. set(PICO_SDK 1 PARENT_SCOPE)
  22. endif()
  23. # allow customization
  24. add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
  25. add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
  26. add_subdirectory(tools)
  27. add_subdirectory(src)
  28. # allow customization
  29. add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
  30. add_sub_list_files(PICO_SDK_POST_LIST_FILES)
  31. if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
  32. set(PICO_SDK_TESTS_ENABLED 1)
  33. endif()
  34. if (PICO_SDK_TESTS_ENABLED)
  35. add_subdirectory(test)
  36. endif ()
  37. set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
  38. # add docs at the end, as we gather documentation dirs as we go
  39. add_subdirectory(docs)
  40. if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
  41. pico_promote_common_scope_vars()
  42. endif()
  43. endif()