function(project_add_target_properties TARGET_NAME) target_compile_definitions(${TARGET_NAME} PRIVATE "$<$:DEBUG>" "$<$>:RELEASE>" GD32F405 ) target_compile_options(${TARGET_NAME} PRIVATE "$<$,$>:-g3>" "$<$,$>:-g3>" "$<$,$>:-g3>" "$<$>,$>:-g0>" "$<$>,$>:-g0>" "$<$>,$>:-g0>" "$<$,$>:-O0>" "$<$,$>:-O0>" "$<$>,$>:-Os>" "$<$>,$>:-Os>" -ffunction-sections -fdata-sections -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) target_link_options(${TARGET_NAME} PRIVATE -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -u _printf_float -static --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections -Wl,--start-group -lc -lm -Wl,--end-group ) target_link_libraries(${TARGET_NAME} PRIVATE m # To use C math library. -lm should be end of the linker script. ) endfunction()