CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. cmake_minimum_required(VERSION 3.8)
  2. cmake_policy(SET CMP0069 NEW)
  3. include(CheckIPOSupported)
  4. check_ipo_supported(RESULT supported OUTPUT error)
  5. if( supported )
  6. message(STATUS "IPO / LTO enabled")
  7. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
  8. else()
  9. message(STATUS "IPO / LTO not supported: <${error}>")
  10. endif()
  11. if (NOT ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AVR" ))
  12. message(FATAL_ERROR "wrong system processor ${CMAKE_SYSTEM_PROCESSOR}, expected: AVR")
  13. endif()
  14. message(STATUS "will use stdlib++ from '${LIBSTDCPP_HOME}'")
  15. add_library(board board.cpp)
  16. target_include_directories(rotor_light PUBLIC "${LIBSTDCPP_HOME}/include")
  17. target_include_directories(board PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
  18. target_link_libraries(board rotor_light)
  19. add_executable(blink-led blink-led.cpp)
  20. target_link_libraries(blink-led board)
  21. add_executable(blink-led-uart blink-led-uart.cpp)
  22. target_link_libraries(blink-led-uart board)
  23. add_executable(ping-pong-poll ping-pong-poll.cpp)
  24. target_link_libraries(ping-pong-poll board)
  25. add_executable(ping-pong-await ping-pong-await.cpp)
  26. target_link_libraries(ping-pong-await board)