# Compiler flags add_compile_options( -g -Os -flto -ffunction-sections -fdata-sections -fmessage-length=0 -msmall-data-limit=8 -march=rv32ec -mabi=ilp32e -DCH32V003=1 -static-libgcc -nostdlib -Wall ) add_executable(${PROJECT_NAME} main.c ) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/extralibs ${CMAKE_SOURCE_DIR}/ch32fun ) target_link_libraries(${PROJECT_NAME} ch32fun #libgcc #${CMAKE_SOURCE_DIR}/libgcc.a ) target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc) set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf") # The other "targets" are size, upload, debug, production, etc #if(NOT TARGET size) #if(NOT TARGET debug) #if(NOT TARGET production) #if(NOT TARGET upload) #endif() #add_library(libgcc STATIC IMPORTED) #set_target_properties(libgcc PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libgcc.a) add_subdirectory(ch32fun) #add_subdirectory(extralibs) add_subdirectory(attic)