mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 13:21:13 +00:00
cmake detect toolchain based on -DCMAKE_C_COMPILER
This commit is contained in:
parent
0fb73eac7e
commit
7545c40003
@ -1,8 +1,16 @@
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
|
||||
set(CMAKE_C_COMPILER "iccarm")
|
||||
set(CMAKE_CXX_COMPILER "iccarm")
|
||||
set(CMAKE_ASM_COMPILER "iasmarm")
|
||||
if (NOT DEFINED CMAKE_C_COMPILER)
|
||||
set(CMAKE_C_COMPILER "iccarm")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER "iccarm")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_ASM_COMPILER)
|
||||
set(CMAKE_ASM_COMPILER "iasmarm")
|
||||
endif()
|
||||
|
||||
set(CMAKE_SIZE "size" CACHE FILEPATH "")
|
||||
set(CMAKE_OBJCOPY "ielftool" CACHE FILEPATH "")
|
||||
|
@ -6,12 +6,24 @@ include(CMakePrintHelpers)
|
||||
set(TOP "${CMAKE_CURRENT_LIST_DIR}/../..")
|
||||
get_filename_component(TOP ${TOP} ABSOLUTE)
|
||||
|
||||
# Default to gcc
|
||||
#-------------------------------------------------------------
|
||||
# Toolchain
|
||||
# Can be changed via -DTOOLCHAIN=gcc|iar or -DCMAKE_C_COMPILER=
|
||||
#-------------------------------------------------------------
|
||||
if (DEFINED CMAKE_C_COMPILER)
|
||||
string(FIND ${CMAKE_C_COMPILER} "iccarm" IS_IAR)
|
||||
if (NOT IS_IAR EQUAL -1)
|
||||
set(TOOLCHAIN iar)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED TOOLCHAIN)
|
||||
set(TOOLCHAIN gcc)
|
||||
endif ()
|
||||
|
||||
# FAMILY not defined, try to detect it from BOARD
|
||||
#-------------------------------------------------------------
|
||||
# FAMILY and BOARD
|
||||
#-------------------------------------------------------------
|
||||
if (NOT DEFINED FAMILY)
|
||||
if (NOT DEFINED BOARD)
|
||||
message(FATAL_ERROR "You must set a FAMILY variable for the build (e.g. rp2040, espressif).
|
||||
@ -74,6 +86,9 @@ set(WARNING_FLAGS_GNU
|
||||
|
||||
set(WARNING_FLAGS_IAR "")
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Functions
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# Filter example based on only.txt and skip.txt
|
||||
function(family_filter RESULT DIR)
|
||||
|
Loading…
x
Reference in New Issue
Block a user