CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. cmake_minimum_required(VERSION 3.5)
  2. include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
  3. # gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
  4. family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
  5. project(${PROJECT})
  6. # Checks this example is valid for the family and initializes the project
  7. family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
  8. add_executable(${PROJECT})
  9. # Example source
  10. target_sources(${PROJECT} PUBLIC
  11. ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
  12. ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
  13. )
  14. # Example include
  15. target_include_directories(${PROJECT} PUBLIC
  16. ${CMAKE_CURRENT_SOURCE_DIR}/src
  17. )
  18. # Example common such as compiler warnings
  19. include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
  20. # due to warnings from other net source, we need to prevent error from some of the warnings options
  21. target_compile_options(${PROJECT} PUBLIC
  22. -Wno-error=shadow
  23. -Wno-error=cast-align
  24. -Wno-error=cast-qual
  25. -Wno-error=redundant-decls
  26. -Wno-error=sign-conversion
  27. -Wno-error=conversion
  28. -Wno-error=sign-compare
  29. -Wno-error=unused-function
  30. )
  31. # Configure compilation flags and libraries for the example... see the corresponding function
  32. # in hw/bsp/FAMILY/family.cmake for details.
  33. family_configure_dual_usb_example(${PROJECT})