src.dualinventive.com/dinet/common/cmake/modules_fw/FindChibiOS.cmake

33 lines
1.1 KiB
CMake

IF(NOT CHIBIOS_ROOT)
SET(CHIBIOS_ROOT ${PROJECT_SOURCE_DIR}/ChibiOS)
ENDIF()
MESSAGE(STATUS "Chibios version:" ${ChibiOS_FIND_VERSION_MAJOR})
IF(ChibiOS_FIND_VERSION_MAJOR EQUAL 2)
MESSAGE(FATAL_ERROR "ChibiOS v2.x.x is not supported. Use older version of stm32-cmake")
ELSEIF((ChibiOS_FIND_VERSION_MAJOR EQUAL 16))
INCLUDE(ChibiOS16)
ELSEIF((ChibiOS_FIND_VERSION_MAJOR EQUAL 18))
INCLUDE(ChibiOS18)
ELSEIF((NOT ChibiOS_FIND_VERSION_MAJOR) OR (ChibiOS_FIND_VERSION_MAJOR EQUAL 3))
INCLUDE(ChibiOS3)
ENDIF()
set(ChibiOS_NAME "ChibiOS")
LIST(REMOVE_DUPLICATES ChibiOS_INCLUDE_DIRS)
LIST(REMOVE_DUPLICATES ChibiOS_SOURCES)
set_source_files_properties(${ChibiOS_SOURCES} PROPERTIES COMPILE_FLAGS "-Wno-conversion")
INCLUDE(FindPackageHandleStandardArgs)
foreach (_srcfile ${ChibiOS_SOURCES})
message(STATUS "${_srcfile}")
endforeach()
foreach (_includefile ${ChibiOS_INCLUDE_DIRS})
message(STATUS "${_includefile}")
endforeach()
message(STATUS "${ChibiOS_LINKER_SCRIPT}")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ChibiOS DEFAULT_MSG ChibiOS_NAME ChibiOS_SOURCES ChibiOS_INCLUDE_DIRS ChibiOS_LINKER_SCRIPT)