CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. cmake_minimum_required(VERSION 3.12)
  2. if (NOT TARGET _pico_sdk_inclusion_marker)
  3. add_library(_pico_sdk_inclusion_marker INTERFACE)
  4. include(pico_sdk_init.cmake)
  5. project(pico_sdk C CXX ASM)
  6. if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  7. if (PICO_DEOPTIMIZED_DEBUG)
  8. message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
  9. else()
  10. message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)")
  11. endif()
  12. endif()
  13. pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT)
  14. set(CMAKE_C_STANDARD 11)
  15. set(CMAKE_CXX_STANDARD 11)
  16. if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
  17. set(PICO_SDK 1 PARENT_SCOPE)
  18. endif()
  19. # allow customization
  20. add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
  21. add_subdirectory(tools)
  22. add_subdirectory(src)
  23. add_compile_options(-Winline)
  24. if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
  25. set(PICO_SDK_TESTS_ENABLED 1)
  26. endif()
  27. if (PICO_SDK_TESTS_ENABLED)
  28. add_subdirectory(test)
  29. endif ()
  30. set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
  31. # allow customization
  32. add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
  33. # add docs at the end, as we gather documentation dirs as we go
  34. add_subdirectory(docs)
  35. endif()