CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. project(stm32f407g_discovery_examples LANGUAGES C CXX ASM)
  2. cmake_minimum_required(VERSION 3.8)
  3. cmake_policy(SET CMP0069 NEW)
  4. include(CheckIPOSupported)
  5. check_ipo_supported(RESULT supported OUTPUT error)
  6. if( supported )
  7. message(STATUS "IPO / LTO enabled")
  8. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
  9. else()
  10. message(STATUS "IPO / LTO not supported: <${error}>")
  11. endif()
  12. add_library(board
  13. Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
  14. Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s
  15. board.cpp
  16. )
  17. target_include_directories(board PUBLIC
  18. "${CMAKE_CURRENT_SOURCE_DIR}"
  19. ${CMAKE_CURRENT_SOURCE_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/
  20. ${CMAKE_CURRENT_SOURCE_DIR}/Drivers/CMSIS/Include/
  21. )
  22. target_compile_definitions(board PUBLIC
  23. STM32F407xx
  24. HSE_VALUE=8000000
  25. )
  26. target_include_directories(board PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
  27. target_link_libraries(board rotor_light)
  28. add_executable("ping-pong-poll" ping-pong-poll.cpp)
  29. target_link_libraries("ping-pong-poll" board)
  30. target_link_options(ping-pong-poll PUBLIC -T ${LINKER_SCRIPT})