CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. cmake_minimum_required(VERSION 3.22)
  2. project(stm32cubemx)
  3. add_library(stm32cubemx INTERFACE)
  4. # Enable CMake support for ASM and C languages
  5. enable_language(C ASM)
  6. target_compile_definitions(stm32cubemx INTERFACE
  7. USE_FULL_LL_DRIVER
  8. USE_HAL_DRIVER
  9. STM32F103xE
  10. $<$<CONFIG:Debug>:DEBUG>
  11. )
  12. target_include_directories(stm32cubemx INTERFACE
  13. ../../Core/Inc
  14. ../../USB_DEVICE/App
  15. ../../USB_DEVICE/Target
  16. ../../Drivers/STM32F1xx_HAL_Driver/Inc
  17. ../../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy
  18. ../../Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  19. ../../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  20. ../../Drivers/CMSIS/Device/ST/STM32F1xx/Include
  21. ../../Drivers/CMSIS/Include
  22. )
  23. target_sources(stm32cubemx INTERFACE
  24. ../../Core/Src/main.c
  25. ../../Core/Src/gpio.c
  26. ../../Core/Src/can.c
  27. ../../Core/Src/usart.c
  28. ../../Core/Src/stm32f1xx_it.c
  29. ../../Core/Src/stm32f1xx_hal_msp.c
  30. ../../USB_DEVICE/App/usb_device.c
  31. ../../USB_DEVICE/App/usbd_desc.c
  32. ../../USB_DEVICE/App/usbd_cdc_if.c
  33. ../../USB_DEVICE/Target/usbd_conf.c
  34. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c
  35. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c
  36. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c
  37. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c
  38. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c
  39. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c
  40. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c
  41. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c
  42. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c
  43. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c
  44. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c
  45. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c
  46. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c
  47. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c
  48. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c
  49. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c
  50. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c
  51. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c
  52. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c
  53. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c
  54. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c
  55. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c
  56. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c
  57. ../../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
  58. ../../Core/Src/system_stm32f1xx.c
  59. ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
  60. ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
  61. ../../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
  62. ../../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
  63. ../../Core/Src/sysmem.c
  64. ../../Core/Src/syscalls.c
  65. ../../startup_stm32f103xe.s
  66. )
  67. target_link_directories(stm32cubemx INTERFACE
  68. )
  69. target_link_libraries(stm32cubemx INTERFACE
  70. )
  71. # Validate that STM32CubeMX code is compatible with C standard
  72. if(CMAKE_C_STANDARD LESS 11)
  73. message(ERROR "Generated code requires C11 or higher")
  74. endif()