CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. cmake_minimum_required(VERSION 3.22)
  2. #
  3. # This file is generated only once,
  4. # and is not re-generated if converter is called multiple times.
  5. #
  6. # User is free to modify the file as much as necessary
  7. #
  8. # Setup compiler settings
  9. set(CMAKE_C_STANDARD 11)
  10. set(CMAKE_C_STANDARD_REQUIRED ON)
  11. set(CMAKE_C_EXTENSIONS ON)
  12. # Define the build type
  13. if(NOT CMAKE_BUILD_TYPE)
  14. set(CMAKE_BUILD_TYPE "Debug")
  15. endif()
  16. # Set the project name
  17. set(CMAKE_PROJECT_NAME msts)
  18. # Include toolchain file
  19. include("cmake/gcc-arm-none-eabi.cmake")
  20. # Enable compile command to ease indexing with e.g. clangd
  21. set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
  22. # Enable CMake support for ASM and C languages
  23. enable_language(C ASM)
  24. # Core project settings
  25. project(${CMAKE_PROJECT_NAME})
  26. message("Build type: " ${CMAKE_BUILD_TYPE})
  27. # Create an executable object type
  28. add_executable(${CMAKE_PROJECT_NAME})
  29. # Add STM32CubeMX generated sources
  30. add_subdirectory(cmake/stm32cubemx)
  31. # Link directories setup
  32. target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE
  33. # Add user defined library search paths
  34. )
  35. # Add sources to executable
  36. target_sources(${CMAKE_PROJECT_NAME} PRIVATE
  37. # Add user sources here
  38. App/Can/Src/can_task.c
  39. App/Can/Src/can_interface.c
  40. App/Common/Src/hal_math.c
  41. App/Task/Src/schedule.c
  42. App/Task/Src/task.c
  43. App/Uart/Src/uart_interface.c
  44. App/Uart/Src/uart_table.c
  45. App/Uart/Src/uart_task.c
  46. )
  47. # Add include paths
  48. target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
  49. # Add user defined include paths
  50. App/Common/Inc
  51. App/Can/Inc
  52. App/Task/Inc
  53. App/Uart/Inc
  54. )
  55. # Add project symbols (macros)
  56. target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
  57. # Add user defined symbols
  58. )
  59. # Add linked libraries
  60. target_link_libraries(${CMAKE_PROJECT_NAME}
  61. stm32cubemx
  62. # Add user defined libraries
  63. )