1234567891011121314151617181920212223242526272829303132333435363738 |
- project(stm32f407g_discovery_examples LANGUAGES C CXX ASM)
- cmake_minimum_required(VERSION 3.8)
- cmake_policy(SET CMP0069 NEW)
- include(CheckIPOSupported)
- check_ipo_supported(RESULT supported OUTPUT error)
- if( supported )
- message(STATUS "IPO / LTO enabled")
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
- else()
- message(STATUS "IPO / LTO not supported: <${error}>")
- endif()
- add_library(board
- Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
- Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s
- board.cpp
- )
- target_include_directories(board PUBLIC
- "${CMAKE_CURRENT_SOURCE_DIR}"
- ${CMAKE_CURRENT_SOURCE_DIR}/Drivers/CMSIS/Device/ST/STM32F4xx/Include/
- ${CMAKE_CURRENT_SOURCE_DIR}/Drivers/CMSIS/Include/
- )
- target_compile_definitions(board PUBLIC
- STM32F407xx
- HSE_VALUE=8000000
- )
- target_include_directories(board PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
- target_link_libraries(board rotor_light)
- add_executable("ping-pong-poll" ping-pong-poll.cpp)
- target_link_libraries("ping-pong-poll" board)
- target_link_options(ping-pong-poll PUBLIC -T ${LINKER_SCRIPT})
|