CMakeLists.txt 722 B

123456789101112131415161718192021222324252627
  1. # Set minimum required version of CMake
  2. cmake_minimum_required(VERSION 3.12)
  3. # Include build functions from Pico SDK
  4. include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
  5. # Creates a pico-sdk subdirectory in our project for the libraries
  6. pico_sdk_init()
  7. # Set name of project (as PROJECT_NAME) and C/C standards
  8. project(foo C CXX ASM)
  9. set(CMAKE_C_STANDARD 11)
  10. set(CMAKE_CXX_STANDARD 17)
  11. # Add library information
  12. add_library(${PROJECT_NAME}
  13. inc/foo.h
  14. src/foo.cpp
  15. )
  16. # Set local include directories
  17. target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
  18. # Link to external lib pico_stdlib (gpio, time, etc. functions)
  19. target_link_libraries(${PROJECT_NAME}
  20. pico_stdlib
  21. )